网站首页  词典首页

请输入您要查询的函数:

 

术语 findfirstprinterchangenotification
释义 FindFirstPrinterChangeNotification
语法:
HANDLE FindFirstPrinterChangeNotification(
__in HANDLE hPrinter,
DWORD fdwFilter,
DWORD fdwOptions,
__in_opt LPVOID pPrinterNotifyOptions
);
FindFirstPrinterChangeNotification功能
该FindFirstPrinterChangeNotification函数创建一个改变通知对象,并返回一个对象的句柄。然后您可以使用此句柄调用等功能的监测到打印机或打印服务器的变化之一。
在FindFirstPrinterChangeNotification调用指定类型的变化进行监测。您可以指定为条件的变化,信息等领域的打印机设置监视器来监视,或两者兼而有之。
关于更改通知处理等操作成功时,指定的变化之一,在指定的打印机或打印服务器上发生。然后调用FindNextPrinterChangeNotification函数来检索有关变化信息,并重置为在未来等待操作使用更改通知对象。
参数
hPrinter [in]
句柄到打印机或打印服务器,您想要监视。使用OpenPrinter或添加打印机函数检索打印机处理。
fdwFilter
条件会导致更改通知对象进入信号状态。更改通知当其中一个或多个特定的条件得到满足。该fdwFilter参数可以是零,如果pPrinterNotifyOptions是非空。
此参数可以是一个或多个下列值。
ValueMeaning
PRINTER_CHANGE_FORMNotify任何一个形态的变化。您可以设置这个一般标志或一个或多个下列具体标志:
PRINTER_CHANGE_ADD_FORM
PRINTER_CHANGE_SET_FORM
PRINTER_CHANGE_DELETE_FORM
PRINTER_CHANGE_JOBNotify的任何工作变动。您可以设置这个一般标志或一个或多个下列具体标志:
PRINTER_CHANGE_ADD_JOB
PRINTER_CHANGE_SET_JOB
PRINTER_CHANGE_DELETE_JOB
PRINTER_CHANGE_WRITE_JOB
PRINTER_CHANGE_PORTNotify的任何一个端口的变化。您可以设置这个一般标志或一个或多个下列具体标志:
PRINTER_CHANGE_ADD_PORT
PRINTER_CHANGE_CONFIGURE_PORT
PRINTER_CHANGE_DELETE_PORT
PRINTER_CHANGE_PRINT_PROCESSORNotify的任何一个打印处理器的变化。您可以设置这个一般标志或一个或多个下列具体标志:
PRINTER_CHANGE_ADD_PRINT_PROCESSOR
PRINTER_CHANGE_DELETE_PRINT_PROCESSOR
PRINTER_CHANGE_PRINTERNotify的任何一台打印机的变化。您可以设置这个一般标志或一个或多个下列具体标志:
PRINTER_CHANGE_ADD_PRINTER
PRINTER_CHANGE_SET_PRINTER
PRINTER_CHANGE_DELETE_PRINTER
PRINTER_CHANGE_FAILED_CONNECTION_PRINTER
PRINTER_CHANGE_PRINTER_DRIVERNotify的任何打印机驱动程序的变化。您可以设置这个一般标志或一个或多个下列具体标志:
PRINTER_CHANGE_ADD_PRINTER_DRIVER
PRINTER_CHANGE_SET_PRINTER_DRIVER
PRINTER_CHANGE_DELETE_PRINTER_DRIVER
PRINTER_CHANGE_ALLNotify如果发生上述任何更改。
PRINTER_CHANGE_SERVERWindows 7:通知到服务器任何变化。
这个标志是不包括在通过设置PRINTER_CHANGE_ALL监测值的变化。
对于上表的更具体的标志说明,请参阅FindNextPrinterChangeNotification功能。
fdwOptions
版权所有;必须为零。
pPrinterNotifyOptions [中,可选]
一个 PRINTER_NOTIFY_OPTIONS结构的指针。这一结构pTypes成员是一个或多个PRINTER_NOTIFY_OPTIONS_TYPE结构的数组,其中每个指定一个打印机信息领域的监管。更改通知时发生的一个或多个指定字段的变化。当变化发生时,FindNextPrinterChangeNotification功能,可以检索新的打印机的信息。此参数可以为NULL,如果是非零fdwFilter。
如需字段列表,可以进行监测,见PRINTER_NOTIFY_OPTIONS_TYPE。
返回值
如果函数成功,返回值是一个句柄更改通知对象指定的打印机或打印服务器相关联。
如果函数失败,返回值是INVALID_HANDLE_VALUE。
备注
为了监测打印机或打印服务器,调用FindFirstPrinterChangeNotification函数,然后使用返回的更改通知对象调用句柄在等待职能之一。关于更改通知对象等待操作是满足的时候更改通知对象进入信号状态。该系统信号的对象,其中一条由fdwFilter或pPrinterNotifyOptions指定的变更或多个监测打印机或打印服务器上发生。
当您调用FindFirstPrinterChangeNotification,要么fdwFilter必须非零或pPrinterNotifyOptions必须非空。如果两者都指定,通知将出现两个。
当打印机上的一个改变通知对象等待操作满意,调用FindNextPrinterChangeNotification函数来确定通知的原因。对于由fdwFilter指明的条件,FindNextPrinterChangeNotification报告情况或变化的条件。对于打印机信息pPrinterNotifyOptions指定字段,FindNextPrinterChangeNotification报告外地或更改,以及为这些领域的新信息领域。 FindNextPrinterChangeNotification还重置更改通知反对无信号状态,以便您可以使用在另一个等待操作继续监测打印机或打印服务器。
有一个例外,不要调用FindNextPrinterChangeNotification功能的改变,是否通知对象不在信号状态。如果等待函数返回值WAIT_TIMEOUT,更改对象不在信号状态。函数调用FindNextPrinterChangeNotification只有等待函数成功不超时。唯一的例外是当FindNextPrinterChangeNotification但与pPrinterNotifyOptions参数设置PRINTER_NOTIFY_OPTIONS_REFRESH位调用。
当您不再需要更改通知对象,通过调用关闭FindClosePrinterChangeNotification函数。
来电的FindFirstPrinterChangeNotification必须确保打印机句柄传递到FindFirstPrinterChangeNotification仍然有效,直到FindClosePrinterChangeNotification调用。如果打印机句柄之前关闭打印机更改通知处理,进一步的通知将无法交付。
注意:在带有Service Pack 2(SP2)和更高版本XP中,Internet连接防火墙(ICF)块默认打印机端口,而是对文件和打印共享例外可以启用。如果用户对一台打印机连接到另一台机器,并且未启用的例外,那么用户将不会收到来自服务器的打印机更改通知。一台机器管理员必须启用例外。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinspool.h(头文件:winuser.h)
LibraryWinspool.lib
参见
Printing and Print Spooler Overview
Printing and Print Spooler 函数
FindClosePrinterChangeNotification
FindNextPrinterChangeNotification
OpenPrinter
PRINTER_NOTIFY_OPTIONS
PRINTER_NOTIFY_OPTIONS_TYPE
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月11日
==英文原文==FindFirstPrinterChangeNotification Function
The FindFirstPrinterChangeNotification function creates a change notification object and returns a handle to the object. You can then use this handle in a call to one of the wait functions to monitor changes to the printer or print server.
The FindFirstPrinterChangeNotification call specifies the type of changes to be monitored. You can specify a set of conditions to monitor for changes, a set of printer information fields to monitor, or both.
A wait operation on the change notification handle succeeds when one of the specified changes occurs in the specified printer or print server. You then call the FindNextPrinterChangeNotification function to retrieve information about the change, and to reset the change notification object for use in the next wait operation.
Syntax
HANDLE FindFirstPrinterChangeNotification(
__in HANDLE hPrinter,
DWORD fdwFilter,
DWORD fdwOptions,
__in_opt LPVOID pPrinterNotifyOptions
);
Parameters
hPrinter [in]
A handle to the printer or print server that you want to monitor. Use the OpenPrinter or AddPrinter function to retrieve a printer handle.
fdwFilter
The conditions that will cause the change notification object to enter a signaled state. A change notification occurs when one or more of the specified conditions are met. The fdwFilter parameter can be zero if pPrinterNotifyOptions is non-NULL.
This parameter can be one or more of the following values.
ValueMeaning
PRINTER_CHANGE_FORMNotify of any changes to a form. You can set this general flag or one or more of the following specific flags:
PRINTER_CHANGE_ADD_FORM
PRINTER_CHANGE_SET_FORM
PRINTER_CHANGE_DELETE_FORM
PRINTER_CHANGE_JOBNotify of any changes to a job. You can set this general flag or one or more of the following specific flags:
PRINTER_CHANGE_ADD_JOB
PRINTER_CHANGE_SET_JOB
PRINTER_CHANGE_DELETE_JOB
PRINTER_CHANGE_WRITE_JOB
PRINTER_CHANGE_PORTNotify of any changes to a port. You can set this general flag or one or more of the following specific flags:
PRINTER_CHANGE_ADD_PORT
PRINTER_CHANGE_CONFIGURE_PORT
PRINTER_CHANGE_DELETE_PORT
PRINTER_CHANGE_PRINT_PROCESSORNotify of any changes to a print processor. You can set this general flag or one or more of the following specific flags:
PRINTER_CHANGE_ADD_PRINT_PROCESSOR
PRINTER_CHANGE_DELETE_PRINT_PROCESSOR
PRINTER_CHANGE_PRINTERNotify of any changes to a printer. You can set this general flag or one or more of the following specific flags:
PRINTER_CHANGE_ADD_PRINTER
PRINTER_CHANGE_SET_PRINTER
PRINTER_CHANGE_DELETE_PRINTER
PRINTER_CHANGE_FAILED_CONNECTION_PRINTER
PRINTER_CHANGE_PRINTER_DRIVERNotify of any changes to a printer driver. You can set this general flag or one or more of the following specific flags:
PRINTER_CHANGE_ADD_PRINTER_DRIVER
PRINTER_CHANGE_SET_PRINTER_DRIVER
PRINTER_CHANGE_DELETE_PRINTER_DRIVER
PRINTER_CHANGE_ALLNotify if any of the preceding changes occur.
PRINTER_CHANGE_SERVERWindows 7: Notify of any changes to the server.
This flag is not included in the changes monitored by setting the PRINTER_CHANGE_ALL value.

For descriptions of the more specific flags in the preceding table, see the FindNextPrinterChangeNotification function.
fdwOptions
Reserved; must be zero.
pPrinterNotifyOptions [in, optional]
A pointer to a PRINTER_NOTIFY_OPTIONS structure. The pTypes member of this structure is an array of one or more PRINTER_NOTIFY_OPTIONS_TYPE structures, each of which specifies a printer information field to monitor. A change notification occurs when one or more of the specified fields changes. When a change occurs, the FindNextPrinterChangeNotification function can retrieve the new printer information. This parameter can be NULL if fdwFilter is nonzero.
For a list of fields that can be monitored, see PRINTER_NOTIFY_OPTIONS_TYPE.
Return Value
If the function succeeds, the return value is a handle to a change notification object associated with the specified printer or print server.
If the function fails, the return value is INVALID_HANDLE_VALUE.
Remarks
To monitor a printer or print server, call the FindFirstPrinterChangeNotification function, then use the returned change notification object handle in a call to one of the wait functions . A wait operation on a change notification object is satisfied when the change notification object enters the signaled state. The system signals the object when one or more of the changes specified by fdwFilter or pPrinterNotifyOptions occurs in the monitored printer or print server.
When you call FindFirstPrinterChangeNotification, either fdwFilter must be nonzero or pPrinterNotifyOptions must be non-NULL. If both are specified, notifications will occur for both.
When a wait operation on a printer change notification object is satisfied, call the FindNextPrinterChangeNotification function to determine the cause of the notification. For a condition specified by fdwFilter, FindNextPrinterChangeNotification reports the condition or conditions that changed. For a printer information field specified by pPrinterNotifyOptions, FindNextPrinterChangeNotification reports the field or fields that changed as well as the new information for these fields. FindNextPrinterChangeNotification also resets the change notification object to the nonsignaled state so you can use it in another wait operation to continue monitoring the printer or print server.
With one exception, do not call the FindNextPrinterChangeNotification function if the change notification object is not in the signaled state. If the wait function returns the value WAIT_TIMEOUT, the change object is not in the signaled state. Call the FindNextPrinterChangeNotification function only if the wait function succeeds without timing out. The exception is when FindNextPrinterChangeNotification is called with the PRINTER_NOTIFY_OPTIONS_REFRESH bit set in the pPrinterNotifyOptions parameter.
When you no longer need the change notification object, close it by calling the FindClosePrinterChangeNotification function.
Callers of FindFirstPrinterChangeNotification must ensure that the printer handle passed into FindFirstPrinterChangeNotification remains valid until FindClosePrinterChangeNotification is called. If the printer handle is closed before the printer change notification handle, further notifications will fail to be delivered.
Note In Windows XP with Service Pack 2 (SP2) and later, the Internet Connection Firewall (ICF) blocks printer ports by default, but an exception for File and Print Sharing can be enabled. If a user makes a printer connection to another machine, and the exception is not enabled, then the user will not receive printer change notifications from the server. A machine admin will have to enable exception.
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinspool.h (include Windows.h)
LibraryWinspool.lib
See Also
Printing and Print Spooler Overview
Printing and Print Spooler Functions
FindClosePrinterChangeNotification
FindNextPrinterChangeNotification
OpenPrinter
PRINTER_NOTIFY_OPTIONS
PRINTER_NOTIFY_OPTIONS_TYPE
Send comments about this topic to Microsoft
Build date: 7/11/2009
==原始网址==http://msdn.microsoft.com/en-us/library/dd162722(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:31:11