网站首页  词典首页

请输入您要查询的函数:

 

术语 getprinter
释义 GetPrinter
语法:
BOOL GetPrinter(
__in HANDLE hPrinter,
__in DWORD Level,
__out LPBYTE pPrinter,
__in DWORD cbBuf,
__out LPDWORD pcbNeeded
);
GetPrinter函数
该GetPrinter函数检索有关指定打印机。
参数
hPrinter [in]
一个句柄,打印机其功能检索信息。使用OpenPrinter或添加打印机函数检索打印机处理。
Level [in]
的Level或结构类型到缓冲区的功能商店指向pPrinter。
该值可以是1,2,3,4,5,6,7,8或9。
pPrinter [out]
A到接收缓冲区结构,其中包含指定的打印机信息的指针。该缓冲区必须足够大,接受的结构和任何条件或其他数据,该结构成员点。如果缓冲区太小,pcbNeeded参数返回所需的缓冲区大小。
的结构类型取决于Level值。
LevelStructure
第1A PRINTER_INFO_1结构包含一般的打印机信息。
甲PRINTER_INFO_2结构包含有关打印机的详细信息。
第3A PRINTER_INFO_3结构包含打印机的安全信息。
第4A PRINTER_INFO_4结构包含最小的打印机信息,包括打印机的名称,服务器名称,打印机是否是远程或本地。
5A条PRINTER_INFO_5结构包含打印机信息,如打印机属性和超时设置。
6A条PRINTER_INFO_6结构指定一个打印机的状态值。
第7A PRINTER_INFO_7结构,指示打印机是否在目录服务中公布。
8A条PRINTER_INFO_8结构指定全局默认打印机设置。
9A条PRINTER_INFO_9结构指定每个用户的默认打印机设置。
cbBuf [in]
大小,指出以字节为缓冲区的pPrinter。
pcbNeeded [out]
对变量的指针,函数设置的大小,以字节为单位的打印机信息。如果cbBuf小于这个值小,GetPrinter失败,和值表示所需的缓冲区大小。如果cbBuf等于或大于这个值,GetPrinter成功,和值表示存储在缓冲区中的字节数。
返回值
如果函数成功,返回值是一个非零值。
如果函数失败,返回值是零。
备注
在PRINTER_INFO_2,PRINTER_INFO_8和PRINTER_INFO_9结构pDevMode成员可以为NULL。当发生这种情况,该打印机驱动程序无法使用,直到重新安装成功。
对于PRINTER_INFO_2和PRINTER_INFO_3结构包含一个指向安全描述符,函数检索安全描述符只有那些组件,调用者有权限读取。要检索特定的安全描述符组件,您必须指定必需的访问权限时,您调用OpenPrinter函数来处理检索到打印机。下表显示所需的访问读取各种安全描述符组成部分的权利。
访问RightSecurity描述组件
READ_CONTROLOwner
小学组
自由访问控制列表(DACL)
ACCESS_SYSTEM_SECURITYSystem访问控制列表(SACL)
如果您指定的Level7,PRINTER_INFO_7返回一个下列值dwAction成员表示打印机是否在目录服务中公布。
dwAction valueMeaning
DSPRINT_PUBLISHThe打印机被发布。该pszObjectGUID成员包含目录服务的打印队列对象的GUID与打印机有关。
DSPRINT_UNPUBLISHThe打印机没有公布。
DSPRINT_PENDINGIndicates该系统正试图完成发布或取消发布操作。如果调用失败SetPrinter发布或取消发布打印机时,系统会进一步尝试在后台完成的操作。
与Windows Vista的印表机GetPrinter开始返回的数据是从本地缓存中检索时hPrinter是指打印机使用由打印服务器和至少有一个开放连接到打印服务器。在所有其他配置,打印机数据查询从打印服务器。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinspool.h(头文件:winuser.h)
LibraryWinspool.lib
DLLSpoolss.dll
Unicode和ANSI namesGetPrinterW(Unicode)和GetPrinterA(ANSI)的
参见
Printing and Print Spooler Overview
Printing and Print Spooler 函数
AbortPrinter
添加打印机
ClosePrinter
DeletePrinter
EnumPrinters
PRINTER_INFO_1
PRINTER_INFO_2
PRINTER_INFO_3
PRINTER_INFO_4
PRINTER_INFO_5
PRINTER_INFO_7
PRINTER_INFO_8
PRINTER_INFO_9
OpenPrinter
SetPrinter
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月11日
==英文原文==GetPrinter Function
The GetPrinter function retrieves information about a specified printer.
Syntax
BOOL GetPrinter(
__in HANDLE hPrinter,
__in DWORD Level,
__out LPBYTE pPrinter,
__in DWORD cbBuf,
__out LPDWORD pcbNeeded
);
Parameters
hPrinter [in]
A handle to the printer for which the function retrieves information. Use the OpenPrinter or AddPrinter function to retrieve a printer handle.
Level [in]
The level or type of structure that the function stores into the buffer pointed to by pPrinter.
This value can be 1, 2, 3, 4, 5, 6, 7, 8 or 9.
pPrinter [out]
A pointer to a buffer that receives a structure containing information about the specified printer. The buffer must be large enough to receive the structure and any strings or other data to which the structure members point. If the buffer is too small, the pcbNeeded parameter returns the required buffer size.
The type of structure is determined by the value of Level.
LevelStructure
1A PRINTER_INFO_1 structure containing general printer information.
2A PRINTER_INFO_2 structure containing detailed information about the printer.
3A PRINTER_INFO_3 structure containing the printer's security information.
4A PRINTER_INFO_4 structure containing minimal printer information, including the name of the printer, the name of the server, and whether the printer is remote or local.
5A PRINTER_INFO_5 structure containing printer information such as printer attributes and time-out settings.
6A PRINTER_INFO_6 structure specifying the status value of a printer.
7A PRINTER_INFO_7 structure that indicates whether the printer is published in the directory service.
8A PRINTER_INFO_8 structure specifying the global default printer settings.
9A PRINTER_INFO_9 structure specifying the per-user default printer settings.

cbBuf [in]
The size, in bytes, of the buffer pointed to by pPrinter.
pcbNeeded [out]
A pointer to a variable that the function sets to the size, in bytes, of the printer information. If cbBuf is smaller than this value, GetPrinter fails, and the value represents the required buffer size. If cbBuf is equal to or greater than this value, GetPrinter succeeds, and the value represents the number of bytes stored in the buffer.
Return Value
If the function succeeds, the return value is a nonzero value.
If the function fails, the return value is zero.
Remarks
The pDevMode member in the PRINTER_INFO_2, PRINTER_INFO_8, and PRINTER_INFO_9 structures can be NULL. When this happens, the printer is unusable until the driver is reinstalled successfully.
For the PRINTER_INFO_2 and PRINTER_INFO_3 structures that contain a pointer to a security descriptor, the function retrieves only those components of the security descriptor that the caller has permission to read. To retrieve particular security descriptor components, you must specify the necessary access rights when you call the OpenPrinter function to retrieve a handle to the printer. The following table shows the access rights required to read the various security descriptor components.
Access RightSecurity Descriptor Component
READ_CONTROLOwner
Primary group
Discretionary access-control list (DACL)
ACCESS_SYSTEM_SECURITYSystem access-control list (SACL)

If you specify level 7, the dwAction member of PRINTER_INFO_7 returns one of the following values to indicate whether the printer is published in the directory service.
dwAction valueMeaning
DSPRINT_PUBLISHThe printer is published. The pszObjectGUID member contains the GUID of the directory services print queue object associated with the printer.
DSPRINT_UNPUBLISHThe printer is not published.
DSPRINT_PENDINGIndicates that the system is attempting to complete a publish or unpublish operation. If a SetPrinter call fails to publish or unpublish a printer, the system makes further attempts to complete the operation in the background.

Starting with Windows Vista, the printer data returned by GetPrinter is retrieved from a local cache when hPrinter refers to a printer hosted by a print server and there is at least one open connection to the print server. In all other configurations, the printer data is queried from the print server.
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinspool.h (include Windows.h)
LibraryWinspool.lib
DLLSpoolss.dll
Unicode and ANSI namesGetPrinterW (Unicode) and GetPrinterA (ANSI)
See Also
Printing and Print Spooler Overview
Printing and Print Spooler Functions
AbortPrinter
AddPrinter
ClosePrinter
DeletePrinter
EnumPrinters
PRINTER_INFO_1
PRINTER_INFO_2
PRINTER_INFO_3
PRINTER_INFO_4
PRINTER_INFO_5
PRINTER_INFO_7
PRINTER_INFO_8
PRINTER_INFO_9
OpenPrinter
SetPrinter
Send comments about this topic to Microsoft
Build date: 7/11/2009
==原始网址==http://msdn.microsoft.com/en-us/library/dd144911(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:25:57