FindNextPrinterChangeNotification
The FindNextPrinterChangeNotification
function retrieves information about the most recent change notification for a
change notification object associated with a printer or print server. Call this
function when a wait operation on the change notification object is satisfied.
The function
also resets the change notification object to the not-signaled state. You can
then use the object in another wait operation to continue monitoring the
printer or print server. The operating system will set the object to the
signaled state the next time one of a specified set of changes occurs to the
printer or print server. The FindFirstPrinterChangeNotification
BOOL FindNextPrinterChangeNotification(
HANDLE hChange, |
// handle to change
notification object of interest |
PDWORD pdwChange, |
// pointer to a
value that indicates the condition that changed |
LPVOID pPrinterNotifyOptions, |
// pointer to a
structure that specifies a refresh flag |
LPVOID *ppPrinterNotifyInfo |
// pointer to a
pointer that receives printer information buffer |
); |
|
Parameters
hChange
Handle to a
change notification object associated with a printer or print server. You
obtain such a handle by calling the FindFirstPrinterChangeNotification
pdwChange
Pointer to a
doubleword variable whose bits are set to indicate the changes that occurred to
cause the most recent notification. The bit flags that might be set correspond
to those specified in the fdwFlags parameter of the FindFirstPrinterChangeNotification
call. The system sets one or more of the following bit flags:
Value |
Meaning |
|
PRINTER_CHANGE_ADD_FORM |
|
|
|
A form was
added to the server. |
|
PRINTER_CHANGE_ADD_JOB |
|
|
|
A print job
was sent to the printer. |
|
PRINTER_CHANGE_ADD_PORT |
|
|
|
A port or
monitor was added to the server. |
|
PRINTER_CHANGE_ADD_PRINT_PROCESSOR |
|
|
|
A print
processor was added to the server. |
|
PRINTER_CHANGE_ADD_PRINTER |
|
|
|
A printer
was added to the server. |
|
PRINTER_CHANGE_ADD_PRINTER_DRIVER |
|
|
|
A printer
driver was added to the server. |
|
PRINTER_CHANGE_CONFIGURE_PORT |
|
|
|
A port was
configured on the server. |
|
PRINTER_CHANGE_DELETE_FORM |
|
|
|
A form was
deleted from the server. |
|
PRINTER_CHANGE_DELETE_JOB |
|
|
|
A job was
deleted. |
|
PRINTER_CHANGE_DELETE_PORT |
|
|
|
A port or
monitor was deleted from the server. |
|
PRINTER_CHANGE_DELETE_PRINT_PROCESSOR |
|
|
|
A print
processor was deleted from the server. |
|
PRINTER_CHANGE_DELETE_PRINTER |
|
|
|
A printer
was deleted. |
|
PRINTER_CHANGE_DELETE_PRINTER_DRIVER |
|
|
|
A printer
driver was deleted from the server. |
|
PRINTER_CHANGE_FAILED_CONNECTION_PRINTER |
|
|
|
A printer
connection has failed. |
|
PRINTER_CHANGE_SET_FORM |
|
|
|
A form was
set on the server. |
|
PRINTER_CHANGE_SET_JOB |
|
|
|
A job was
set. |
|
PRINTER_CHANGE_SET_PRINTER |
|
|
|
A printer
was set. |
|
PRINTER_CHANGE_SET_PRINTER_DRIVER
|
|
|
|
A printer
driver was set. |
|
PRINTER_CHANGE_WRITE_JOB |
|
|
|
Job data
was written. |
|
pPrinterNotifyOptions
Pointer to a PRINTER_NOTIFY_OPTIONS
ppPrinterNotifyInfo
Pointer to a
pointer variable that receives the address of a system-allocated, read-only
buffer. Call the FreePrinterNotifyInfo
The buffer
contains a PRINTER_NOTIFY_INFO
If the
PRINTER_NOTIFY_INFO_DISCARDED bit is set in the Flags member of the PRINTER_NOTIFY_INFO
structure, an overflow or error occurred, and notifications may have been lost.
In this case, no additional notifications will be sent until you make a second FindNextPrinterChangeNotification
call that specifies PRINTER_NOTIFY_OPTIONS_REFRESH.
Return Values
If the
function succeeds, the return value is nonzero.
If the
function fails, the return value is zero. To get extended error information,
call GetLastError
Remarks
Call the FindNextPrinterChangeNotification
function after a wait operation on a notification object created by FindFirstPrinterChangeNotification
Do not call
the FindNextPrinterChangeNotification function if the change
notification object is not in the signaled state. If a 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.
To continue
monitoring the printer or print server for changes, repeat the cycle of calling
one of the wait functions
FindNextPrinterChangeNotification may combine multiple changes to the same printer
information field into a single notification. When this occurs, the function
typically collapses all changes for the field into a single entry in the array
of PRINTER_NOTIFY_INFO_DATA structures in ppPrinterNotifyInfo;
the single entry reports only the most current information. However, for some
job and printer information fields, the function can return multiple array
entries for the same field. In this case, the last array entry for the field
reports the current data, and the earlier entries contain the data for the
intermediate stages.
When you no
longer need the change notification object, close it by calling the FindClosePrinterChangeNotification
The three Find*PrinterChangeNotification
functions, in combination with the wait functions
See Also