AppendPrinterNotifyInfoData function

The print spooler's AppendPrinterNotifyInfoData function adds the contents of a specified PRINTER_NOTIFY_INFO_DATA structure to a specified PRINTER_NOTIFY_INFO structure.

Syntax

BOOL AppendPrinterNotifyInfoData(
  PPRINTER_NOTIFY_INFO      pInfoDest,
  PPRINTER_NOTIFY_INFO_DATA pDataSrc,
  DWORD                     fdwFlags
);

Parameters

pInfoDest

Caller-supplied pointer to a PRINTER_NOTIFY_INFO structure (defined in the Microsoft Windows SDK documentation).

pDataSrc

fdwFlags

Caller-supplied flags. The following flag is defined.

PRINTER_NOTIFY_INFO_DATA_COMPACT

If set, the function examines the Type, Field, and Id members of the supplied PRINTER_NOTIFY_INFO_DATA structure. If they all match an existing element of the PRINTER_NOTIFY_INFO_DATA structure array, the existing element is overwritten with the supplied element. If a match is not found, the function adds the specified structure to the end of the array.

Return Value

If the operation succeeds, the function returns TRUE. Otherwise, the function returns FALSE. The caller can obtain an error code by calling GetLastError (described in the Windows SDK documentation).

Remarks

A print provider's RefreshPrinterChangeNotification function should call AppendPrinterNotifyInfoData as often as necessary to populate a PRINTER_NOTIFY_INFO_DATA structure array, after first calling RouterAllocPrinterNotifyInfo to allocate storage for the array and its associated PRINTER_NOTIFY_INFO structure.

Based on whether the PRINTER_NOTIFY_INFO_DATA_COMPACT flag is set, the function either appends the specified PRINTER_NOTIFY_INFO_DATA structure to the end of the structure array or overwrites an existing array element. If the structure is appended, the function increments the PRINTER_NOTIFY_INFO structure's Count member.

If AppendPrinterNotifyInfoData detects that the PRINTER_NOTIFY_INFO_DISCARDED flag is set in the specified PRINTER_NOTIFY_INFO structure, the function clears all PRINTER_NOTIFY_INFO_DATA structures and sets the error code to ERROR_OUT_OF_STRUCTURES.

If NULL is specified for pInfoDataSrc, AppendPrinterNotifyInfoData sets the PRINTER_NOTIFY_INFO_DISCARDED flag in the specified PRINTER_NOTIFY_INFO structure, clears all PRINTER_NOTIFY_INFO_DATA structures, and sets the error code to ERROR_OUT_OF_STRUCTURES.

(For more information about the PRINTER_NOTIFY_INFO_DISCARDED flag, see the description of FindNextPrinterChangeNotification in the Windows SDK documentation.)

For additional information, see Supporting Printer Change Notifications.

Requirements

   
Target Platform Desktop
Header winsplp.h (include Winsplp.h)
Library Spoolss.lib
DLL Spoolss.dll

See Also

RefreshPrinterChangeNotification

RouterAllocPrinterNotifyInfo