На главную

On-line справка по Win32 API

Написать письмо
БЕСПЛАТНАЯ ежедневная online лотерея! Выигрывай каждый день БЕСПЛАТНО!
Список всех статей A-B-C-D-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-V-W-X-Y-Z | Скачать Вниз

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 function creates the change notification object and specifies the set of changes to be monitored.

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
function. The operating system sets this change notification object to the signaled state when it detects one of the changes specified in the object's change notification filter.

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 structure. Set the Flags member of this structure to PRINTER_NOTIFY_OPTIONS_REFRESH, to cause the function to return the current data for all monitored printer information fields. The function ignores all other members of the structure. This parameter can be NULL.

ppPrinterNotifyInfo

Pointer to a pointer variable that receives the address of a system-allocated, read-only buffer. Call the FreePrinterNotifyInfo function to free the buffer when you are finished with it. This parameter can be NULL if no information is required.
The buffer contains a PRINTER_NOTIFY_INFO structure, which contains an array of PRINTER_NOTIFY_INFO_DATA structures. Each element of the array contains information about one of the fields specified in the pPrinterNotifyOptions parameter of the FindFirstPrinterChangeNotification call. Typically, the function provides data only for the fields that changed to cause the most recent notification. However, if the structure pointed to by the pPrinterNotifyOptions parameter specifies PRINTER_NOTIFY_OPTIONS_REFRESH, the function provides data for all monitored fields.

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 has been satisfied. Calling FindNextPrinterChangeNotification lets you obtain information about the change that satisfied the wait operation, and resets the notification object so it can be signaled when the next change occurs.
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, and then calling the FindNextPrinterChangeNotification function to examine the change and reset the notification object.
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 function.
The three Find*PrinterChangeNotification functions, in combination with the wait functions, provide an asynchronous, more resource-efficient alternative to the WaitForPrinterChange function.

See Also

FindClosePrinterChangeNotification, FindFirstPrinterChangeNotification, PRINTER_NOTIFY_INFO, PRINTER_NOTIFY_INFO_DATA, PRINTER_NOTIFY_OPTIONS, WaitForPrinterChange


Пригласи друзей и счет твоего мобильника всегда будет положительным!
Предыдущая статья
 
Сайт Народ.Ру Интернет
Следующая статья
Пригласи друзей и счет твоего мобильника всегда будет положительным!

FindNextPrinterChangeNotification



Функция FindNextPrinterChangeNotification извлекает информацию о наиболее последнем уведомлении для разнообразия уведомление объекта изменения связанное сервером принтера или распечатки. Назовите эту функцию когда операция ожидания на объекте уведомления изменения удовлетворена.

Функция также сбрасывает объект уведомления изменения против не-сигнализировавшее состояние. Вы можете затем использовать объект на другой операции ожидания, чтобы продолжать проверять принтер или печатать сервер. Операционная система установит объект против сигнального указывать следующий раз одну из определенной установки изменений происходит в сервер принтера или распечатки. Функция FindFirstPrinterChangeNotification создает объект уведомления изменения и определяет установку изменений, которые нужно проверяться.

BOOL FindNextPrinterChangeNotification(

РУЧКА hChange, // оперируется, чтобы изменять объект уведомления интереса PDWORD pdwChange, // указателя в величину, которая указывает условие, что изменившее LPVOID pPrinterNotifyOptions, // указатель в структуру, которая определяет флаг восстановления LPVOID *указатель ppPrinterNotifyInfo // на указатель, который получает информационный буфер принтера
);


Параметры

hChange

Прооперируйте объект уведомления изменения связанный принтером или печатайте сервер. Вы получаете такую ручку вызывая функцию FindFirstPrinterChangeNotification. Операционная система устанавливает этот объект уведомления изменения против сигнального состояния когда она обнаруживает одного из изменений определенных в фильтре уведомления объектного изменения.

pdwChange

Указатель в переменную двойного слова чьи биты установлены, чтобы указывать изменения, которые происходили, чтобы вызывать наиболее последнее уведомление. Бит сигнализирует, что могло быть установкой переписываться на те определенное в параметре fdwFlags вызова FindFirstPrinterChangeNotification. Система устанавливает одно или более из следующего кусать флаги:

Оцените Значение PRINTER_CHANGE_ADD_FORM, которое форма была добавлена к серверу.
PRINTER_CHANGE_ADD_JOB работа распечатки была послана в принтер.
PRINTER_CHANGE_ADD_PORT порт или монитор был добавлен к серверу.
PRINTER_CHANGE_ADD_PRINT_PROCESSOR процессор распечатки был добавлен к серверу.
PRINTER_CHANGE_ADD_PRINTER принтер был добавлен к серверу.
PRINTER_CHANGE_ADD_PRINTER_DRIVER драйвер принтера был добавлен к серверу.
PRINTER_CHANGE_CONFIGURE_PORT порт был сконфигурирован в сервере.
PRINTER_CHANGE_DELETE_FORM форма была удалена из сервера.
PRINTER_CHANGE_DELETE_JOB работа была удалена.
PRINTER_CHANGE_DELETE_PORT порт или монитор был удален из сервера.
PRINTER_CHANGE_DELETE_PRINT_PROCESSOR процессор распечатки был удален из сервера.
PRINTER_CHANGE_DELETE_PRINTER принтер был удален.
PRINTER_CHANGE_DELETE_PRINTER_DRIVER драйвер принтера был удален из сервера.
PRINTER_CHANGE_FAILED_CONNECTION_PRINTER связь принтера потерпела неудачу.
PRINTER_CHANGE_SET_FORM форма была установлена в сервере.
PRINTER_CHANGE_SET_JOB работа была установлена.
PRINTER_CHANGE_SET_PRINTER принтер был установлен.
PRINTER_CHANGE_SET_PRINTER_DRIVER драйвер принтера был установлен.
Характеристика работы PRINTER_CHANGE_WRITE_JOB была записана.


pPrinterNotifyOptions

Указатель в структуру PRINTER_NOTIFY_OPTIONS. Установите элемент Флагов этой структуры на PRINTER_NOTIFY_OPTIONS_REFRESH, чтобы заставлять функцию, чтобы возвращать текущие данные для всех проверившее информационные области принтера. Функция игнорирует всех других участников структуры. Этот параметр может быть НЕДЕЙСТВИТЕЛЕН.

ppPrinterNotifyInfo

Указатель в переменную указателя, которая получает адрес системного-размещенного, только для чтения буфера. Назовите функцию FreePrinterNotifyInfo, чтобы освобождать буфер когда Вы завершены с ним. Этот параметр может быть НЕДЕЙСТВИТЕЛЕН если никакая информация не потребовалась.
Буфер содержит структуру PRINTER_NOTIFY_INFO, которая содержит массив структур PRINTER_NOTIFY_INFO_DATA. Каждый элемент массива содержит информацию о одной из областей определенных в параметре pPrinterNotifyOptions вызова FindFirstPrinterChangeNotification. Обычно, функция обеспечивает данные только для областей, которые изменялись, чтобы вызывать наиболее последнее уведомление. Тем не менее, если структура указанная, чтобы параметром pPrinterNotifyOptions определяет PRINTER_NOTIFY_OPTIONS_REFRESH, функция обеспечивает данные для всех проверившее области.

Если бит PRINTER_NOTIFY_INFO_DISCARDED установлен в элементе Флагов структуры PRINTER_NOTIFY_INFO, переполнение или ошибка происходила, и уведомления возможно потерены. В этом случае, никакие дополнительные уведомления не будут посланы пока Вы не сделаете секунду FindNextPrinterChangeNotification называть, что определяет PRINTER_NOTIFY_OPTIONS_REFRESH.



Обратные Величины

Если функция добивается успеха, обратная величина ненулевая.
Если функция терпит неудачу, обратная величина нулевая. Для того, чтобы расширять информацию ошибки, назовите GetLastError.

Замечания

Назовите FindNextPrinterChangeNotification функционирует после операции ожидания на объекте уведомления созданном FindFirstPrinterChangeNotification удовлетворен. Вызов FindNextPrinterChangeNotification позволяет, чтобы Вы получаете информацию об изменении, которое удовлетворяло операцию ожидания и сбрасывает объект уведомления, так что может быть сигнализировано когда следующее изменение происходит.
Не называйте функцию FindNextPrinterChangeNotification если объект уведомления изменения - не в сигнальном состоянии. Если функция ожидания возвращает величину WAIT_TIMEOUT, объект изменения - не в сигнальном состоянии. Назовите функцию FindNextPrinterChangeNotification только если функция ожидания добивается успеха не синхронизируя.

Для того, чтобы продолжать проверять принтер или печатать сервер для изменений, повторите циклу вызова одну из функций ожидания, и затем вызывая функцию FindNextPrinterChangeNotification, чтобы изучать изменение и восстанавливать объект уведомления.
FindNextPrinterChangeNotification МОЖЕТ объединить многочисленные изменения в ту же информационную область принтера в единственное уведомление. Когда это происходит, функция обычно рушится все изменения для области на единственный вход в массиве структур PRINTER_NOTIFY_INFO_DATA в ppPrinterNotifyInfo; единственный вход сообщает только самый последнюю информацию. Тем не менее, для некоторой работы и информационных областей принтера, функция может возвращать многочисленные данные массива для той же области. В этом случае, последний вход массива для области сообщает текущие данные, и более ранние данные содержат данные для промежуточных этапов.

Когда Вы больше не нужно объект уведомления изменения, закройте этому вызывая функцию FindClosePrinterChangeNotification.
Три функции Find*PrinterChangeNotification, в комбинации с функциями ожидания, обеспечивать асинхронную, более ресурс-эффективную альтернативу для функции WaitForPrinterChange.

Смотри Также

FindClosePrinterChangeNotification, FindFirstPrinterChangeNotification, PRINTER_NOTIFY_INFO, PRINTER_NOTIFY_INFO_DATA, PRINTER_NOTIFY_OPTIONS, WaitForPrinterChange


Вверх Version 1.3, Oct 26 2010 © 2007, 2010, mrhx Вверх
 mrhx software  Русский перевод OpenGL  Русский перевод Win32 API
 
Используются технологии uCoz