网站首页  词典首页

请输入您要查询的函数:

 

术语 addprinter
释义 AddPrinter
语法:
HANDLE AddPrinter(
__in LPTSTR *pName,
__in DWORD Level,
__in LPBYTE pPrinter
);
添加打印机功能
在添加打印机功能添加打印机到支持的打印机指定的服务器列表。
参数
pName [in]
一个指向 null 结尾的字符串指针,指定在其上应安装打印机服务器的名称。如果该字符串为NULL,该打印机安装在本地。
Level [in]
结构的版本的pPrinter点。此值必须是2。
pPrinter [in]
一个 PRINTER_INFO_2结构,其中包含有关打印机的信息的指针。您必须指定一个非空值的pPrinterName,pPortName,pDriverName,以及这种结构pPrintProcessor成员之前调用添加打印机。
返回值
如果函数成功,返回值是一个句柄(不是线程安全),以新的打印机对象。当您完成与处理,将它传递给ClosePrinter函数将其关闭。
如果函数失败,返回值为NULL。
备注
不要在DllMain中调用此方法。
调用者必须有相关权限。
返回的句柄不是线程安全的。如来电者需要使用多线程是同时,他们必须提供自定义的打印机使用的同步处理功能的同步访问。为了避免编写自定义代码的应用程序可以打开打印机每个线程处理,根据需要。
以下是该PRINTER_INFO_2结构,可以在添加打印机功能集合被称为成员:
属性
pPrintProcessor
DefaultPriority
优先
pComment
pSecurityDescriptor
pDatatype
pSepFile
pDevMode
pShareName
pLocation
开始时间
pParameters
UntilTime
的地位,cJobs,以及PRINTER_INFO_2结构AveragePPM成员保留了GetPrinter函数的使用。他们不应设置之前调用添加打印机。
如果pSecurityDescriptor为NULL,系统分配默认的安全描述到打印机。默认的安全描述符具有下列权限。
ValueDescription
Administrators和Power UsersFull在打印队列控制。这意味着这些团体的成员可以打印,管理队列(队列可以删除,更改任何队列设置,包括安全描述符),和管理每个人的工作(删除,暂停,恢复,重新开始工作)。
请注意,电力用户不存在之前,Windows XP专业版。
造物主/ OwnerCan管理自己的职位。这意味着,用户可以提交作业谁管理(删除,暂停,恢复,重新启动)本职工作。
EveryoneExecute和标准读取控制。这意味着在每个组的成员可以打印和读取打印队列属性。
之后,应用程序创建与添加打印机功能的打印机对象,它必须使用PrinterProperties功能来指定与打印机对象关联的打印机驱动程序正确的设置。
在添加打印机函数返回一个错误,如果具有相同名称已经存在打印机对象,除非该对象被搁置删除标记。在这种情况下,现有的打印机不会被删除,并添加打印机创建参数是用来改变现有的打印机设置(如如果应用程序使用了该SetPrinter函数)。
使用EnumPrintProcessors枚举函数在服务器上安装的打印处理器集。使用EnumPrintProcessorDatatypes函数来枚举数据类型,一个打印处理器支持的设置。使用EnumPorts函数来枚举可用的端口设置。使用EnumPrinterDrivers函数来枚举已安装的打印机驱动程序。
在添加打印机函数的调用者必须具有SERVER_ACCESS_ADMINISTER访问服务器上的打印机是要创建的。返回的句柄函数将PRINTER_ALL_ACCESS的许可,可以用来在打印机上执行行政业务。
如果DrvPrinterEvent功能是通过PRINTER_EVENT_FLAG_NO_UI标志,司机不应该使用一个用户界面在DrvPrinterEvent电话。做用户界面有关的工作,安装应该使用的打印机的。inf文件VendorSetup入境或为即插即用设备,安装程序可以使用的设备,具体的合作安装。欲了解更多有关VendorSetup信息,请参阅Microsoft Windows驱动程序开发工具包(DDK)。
Internet连接防火墙(ICF)块默认打印机端口,而是一种例外文件和打印共享被启用当您运行添加打印机。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinspool.h(头文件:winuser.h)
LibraryWinspool.lib
DLLSpoolss.dll
Unicode和ANSI namesAddPrinterW(Unicode)和AddPrinterA(ANSI)的
参见
Printing and Print Spooler Overview
Printing and Print Spooler 函数
ClosePrinter
DeletePrinter
EnumPorts
EnumPrinterDrivers
EnumPrintProcessors
EnumPrintProcessorDatatypes
GetPrinter
PRINTER_INFO_2
PrinterProperties
SetPrinter
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月11日
==英文原文==AddPrinter Function
The AddPrinter function adds a printer to the list of supported printers for a specified server.
Syntax
HANDLE AddPrinter(
__in LPTSTR *pName,
__in DWORD Level,
__in LPBYTE pPrinter
);
Parameters
pName [in]
A pointer to a null-terminated string that specifies the name of the server on which the printer should be installed. If this string is NULL, the printer is installed locally.
Level [in]
The version of the structure to which pPrinter points. This value must be 2.
pPrinter [in]
A pointer to a PRINTER_INFO_2 structure that contains information about the printer. You must specify non-NULL values for the pPrinterName, pPortName, pDriverName, and pPrintProcessor members of this structure before calling AddPrinter.
Return Value
If the function succeeds, the return value is a handle (not thread safe) to a new printer object. When you are finished with the handle, pass it to the ClosePrinter function to close it.
If the function fails, the return value is NULL.
Remarks
Do not call this method in DllMain .
The caller must have the SeLoadDriverPrivilege .
The returned handle is not thread safe. If callers need to use it concurrently on multiple threads, they must provide custom synchronization access to the printer handle using the Synchronization Functions . To avoid writing custom code the application can open a printer handle on each thread, as needed.
The following are the members of the PRINTER_INFO_2 structure that can be set before the AddPrinter function is called:
Attributes
pPrintProcessor
DefaultPriority
Priority
pComment
pSecurityDescriptor
pDatatype
pSepFile
pDevMode
pShareName
pLocation
StartTime
pParameters
UntilTime
The Status, cJobs, and AveragePPM members of the PRINTER_INFO_2 structure are reserved for use by the GetPrinter function. They must not be set before calling AddPrinter.
If pSecurityDescriptor is NULL, the system assigns a default security descriptor to the printer. The default security descriptor has the following permissions.
ValueDescription
Administrators and Power UsersFull control on the print queue. This means members of these groups can print, manage the queue (can delete the queue, change any setting of the queue, including the security descriptor), and manage everybodys jobs (delete, pause, resume, restart jobs).
Note that Power Users do not exist before Windows XP Professional.
Creator/OwnerCan manage own jobs. This means that user who submit jobs can manage (delete, pause, resume, restart) their own jobs.
EveryoneExecute and standard read control. This means that members of the everyone group can print and read properties of the print queue.

After an application creates a printer object with the AddPrinter function, it must use the PrinterProperties function to specify the correct settings for the printer driver associated with the printer object.
The AddPrinter function returns an error if a printer object with the same name already exists, unless that object is marked as pending deletion. In that case, the existing printer is not deleted, and the AddPrinter creation parameters are used to change the existing printer settings (as if the application had used the SetPrinter function).
Use the EnumPrintProcessors function to enumerate the set of print processors installed on a server. Use the EnumPrintProcessorDatatypes function to enumerate the set of data types that a print processor supports. Use the EnumPorts function to enumerate the set of available ports. Use the EnumPrinterDrivers function to enumerate the installed printer drivers.
The caller of the AddPrinter function must have SERVER_ACCESS_ADMINISTER access to the server on which the printer is to be created. The handle returned by the function will have PRINTER_ALL_ACCESS permission, and can be used to perform administrative operations on the printer.
If the DrvPrinterEvent function is passed the PRINTER_EVENT_FLAG_NO_UI flag, the driver should not use a UI call during DrvPrinterEvent. To do UI-related jobs, the installer should either use the VendorSetup entry in the printer's .inf file or, for Plug and Play devices, the installer can use a device-specific co-installer. For more information about VendorSetup, see the Microsoft Windows Driver Development Kit (DDK).
The Internet Connection Firewall (ICF) blocks printer ports by default, but an exception for File and Print Sharing is enabled when you run AddPrinter.
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinspool.h (include Windows.h)
LibraryWinspool.lib
DLLSpoolss.dll
Unicode and ANSI namesAddPrinterW (Unicode) and AddPrinterA (ANSI)
See Also
Printing and Print Spooler Overview
Printing and Print Spooler Functions
ClosePrinter
DeletePrinter
EnumPorts
EnumPrinterDrivers
EnumPrintProcessors
EnumPrintProcessorDatatypes
GetPrinter
PRINTER_INFO_2
PrinterProperties
SetPrinter
Send comments about this topic to Microsoft
Build date: 7/11/2009
==原始网址==http://msdn.microsoft.com/en-us/library/dd183343(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 11:27:53