大网数据广告活动
打印与设备

PRINTER_NOTIFY_INFO_DATA structure (Winspool.h)

· 52CE 我爱测

The PRINTER_NOTIFY_INFO_DATA structure identifies a job or printer information field and provides the current data for that field.

The PRINTER_NOTIFY_INFO_DATA structure identifies a job or printer information field and provides the current data for that field.

The FindNextPrinterChangeNotification function returns a PRINTER_NOTIFY_INFO structure, which contains an array of PRINTER_NOTIFY_INFO_DATA structures.

Syntax

typedef struct _PRINTER_NOTIFY_INFO_DATA {
  WORD  Type;
  WORD  Field;
  DWORD Reserved;
  DWORD Id;
  union {
    DWORD  adwData[2];
    struct {
      DWORD  cbBuf;
      LPVOID pBuf;
    } Data;
  } NotifyData;
} PRINTER_NOTIFY_INFO_DATA, *PPRINTER_NOTIFY_INFO_DATA; ;

Members

Type

Indicates the type of information provided. This member can be one of the following values.

Value Meaning
JOB_NOTIFY_TYPE 0x01 Indicates that the Field member specifies a JOB_NOTIFY_FIELD_* constant.
PRINTER_NOTIFY_TYPE 0x00 Indicates that the Field member specifies a PRINTER_NOTIFY_FIELD_* constant.

Field

Indicates the field that changed. For a list of possible values, see the Remarks section.

Reserved

Reserved.

Id

Indicates the job identifier if the Type member specifies JOB_NOTIFY_TYPE. If the Type member specifies PRINTER_NOTIFY_TYPE, this member is undefined.

NotifyData

A union of data information based on the Type and Field members. For a description of the type of data associated with each field, see the Remarks section.

adwData[2]

An array of two DWORD values. For information fields that use only a single DWORD, the data is in adwData [0].

Data

cbBuf

Indicates the size, in bytes, of the buffer pointed to by pBuf.

pBuf

Pointer to a buffer that contains the field's current data.

Remarks

If the Type member specifies PRINTER_NOTIFY_TYPE, the Field member can be one of the following values.

<table> <thead> <tr class="header"> <th>Field</th> <th>Type of data</th> <th>Value</th> </tr> </thead> <tbody> <tr class="odd"> <td>PRINTER_NOTIFY_FIELD_SERVER_NAME</td> <td>Not supported.</td> <td>0x00</td> </tr> <tr class="even"> <td>PRINTER_NOTIFY_FIELD_PRINTER_NAME</td> <td>pBuf is a pointer to a null-terminated string containing the name of the printer.</td> <td>0x01</td> </tr> <tr class="odd"> <td>PRINTER_NOTIFY_FIELD_SHARE_NAME</td> <td>pBuf is a pointer to a null-terminated string that identifies the share point for the printer.</td> <td>0x02</td> </tr> <tr class="even"> <td>PRINTER_NOTIFY_FIELD_PORT_NAME</td> <td>pBuf is a pointer to a null-terminated string containing the name of the port that the print jobs will be printed to. If "Printer Pooling" is selected, this is a comma separated list of ports.</td> <td>0x03</td> </tr> <tr class="odd"> <td>PRINTER_NOTIFY_FIELD_DRIVER_NAME</td> <td>pBuf is a pointer to a null-terminated string containing the name of the printer's driver.</td> <td>0x04</td> </tr> <tr class="even"> <td>PRINTER_NOTIFY_FIELD_COMMENT</td> <td>pBuf is a pointer to a null-terminated string containing the new comment string, which is typically a brief description of the printer.</td> <td>0x05</td> </tr> <tr class="odd"> <td>PRINTER_NOTIFY_FIELD_LOCATION</td> <td>pBuf is a pointer to a null-terminated string containing the new physical location of the printer (for example, "Bldg. 38, Room 1164").</td> <td>0x06</td> </tr> <tr class="even"> <td>PRINTER_NOTIFY_FIELD_DEVMODE</td> <td>pBuf is a pointer to a <a href="/windows/win32/api/wingdi/ns-wingdi-devmodea">DEVMODE</a> structure that defines default printer data such as the paper orientation and the resolution.</td> <td>0x07</td> </tr> <tr class="odd"> <td>PRINTER_NOTIFY_FIELD_SEPFILE</td> <td>pBuf is a pointer to a null-terminated string that specifies the name of the file used to create the separator page. This page is used to separate print jobs sent to the printer.</td> <td>0x08</td> </tr> <tr class="even"> <td>PRINTER_NOTIFY_FIELD_PRINT_PROCESSOR</td> <td>pBuf is a pointer to a null-terminated string that specifies the name of the print processor used by the printer.</td> <td>0x09</td> </tr> <tr class="odd"> <td>PRINTER_NOTIFY_FIELD_PARAMETERS</td> <td>pBuf is a pointer to a null-terminated string that specifies the default print-processor parameters.</td> <td>0x0A</td> </tr> <tr class="even"> <td>PRINTER_NOTIFY_FIELD_DATATYPE</td> <td>pBuf is a pointer to a null-terminated string that specifies the data type used to record the print job.</td> <td>0x0B</td> </tr> <tr class="odd"> <td>PRINTER_NOTIFY_FIELD_SECURITY_DESCRIPTOR</td> <td>pBuf is a pointer to a <a href="/windows/desktop/api/winnt/ns-winnt-security_descriptor">SECURITY_DESCRIPTOR</a> structure for the printer. The pointer may be NULL if there is no security descriptor.</td> <td>0x0C</td> </tr> <tr class="even"> <td>PRINTER_NOTIFY_FIELD_ATTRIBUTES</td> <td>adwData [0] specifies the printer attributes, which can be one of the following values: PRINTER_ATTRIBUTE_QUEUED PRINTER_ATTRIBUTE_DIRECT PRINTER_ATTRIBUTE_DEFAULT PRINTER_ATTRIBUTE_SHARED </td> <td>0x0D</td> </tr> <tr class="odd"> <td>PRINTER_NOTIFY_FIELD_PRIORITY</td> <td>adwData [0] specifies a priority value that the spooler uses to route print jobs.</td> <td>0x0E</td> </tr> <tr class="even"> <td>PRINTER_NOTIFY_FIELD_DEFAULT_PRIORITY</td> <td>adwData [0] specifies the default priority value assigned to each print job.</td> <td>0x0F</td> </tr> <tr class="odd"> <td>PRINTER_NOTIFY_FIELD_START_TIME</td> <td>adwData [0] specifies the earliest time at which the printer will print a job. (This value is specified in minutes elapsed since 12:00 A.M.)</td> <td>0x10</td> </tr> <tr class="even"> <td>PRINTER_NOTIFY_FIELD_UNTIL_TIME</td> <td>adwData [0] specifies the latest time at which the printer will print a job. (This value is specified in minutes elapsed since 12:00 A.M.)</td> <td>0x11</td> </tr> <tr class="odd"> <td>PRINTER_NOTIFY_FIELD_STATUS</td> <td>adwData [0] specifies the printer status. For a list of possible values, see the <a href="printer-info-2.md">PRINTER_INFO_2</a> structure.</td> <td>0x12</td> </tr> <tr class="even"> <td>PRINTER_NOTIFY_FIELD_STATUS_STRING</td> <td>Not supported.</td> <td>0x13</td> </tr> <tr class="odd"> <td>PRINTER_NOTIFY_FIELD_CJOBS</td> <td>adwData [0] specifies the number of print jobs that have been queued for the printer.</td> <td>0x14</td> </tr> <tr class="even"> <td>PRINTER_NOTIFY_FIELD_AVERAGE_PPM</td> <td>adwData [0] specifies the average number of pages per minute that have been printed on the printer.</td> <td>0x15</td> </tr> <tr class="odd"> <td>PRINTER_NOTIFY_FIELD_TOTAL_PAGES</td> <td>Not supported.</td> <td>0x16</td> </tr> <tr class="even"> <td>PRINTER_NOTIFY_FIELD_PAGES_PRINTED</td> <td>Not supported.</td> <td>0x17</td> </tr> <tr class="odd"> <td>PRINTER_NOTIFY_FIELD_TOTAL_BYTES</td> <td>Not supported.</td> <td>0x18</td> </tr> <tr class="even"> <td>PRINTER_NOTIFY_FIELD_BYTES_PRINTED</td> <td>Not supported.</td> <td>0x19</td> </tr> <tr class="odd"> <td>PRINTER_NOTIFY_FIELD_OBJECT_GUID</td> <td>This is set if the object GUID changes.</td> <td>0x1A</td> </tr> <tr class="even"> <td>PRINTER_NOTIFY_FIELD_FRIENDLY_NAME</td> <td>This is set if the printer connection is renamed.</td> <td>0x1B</td> </tr> </tbody> </table>

If the Type member specifies JOB_NOTIFY_TYPE, the Field member can be one of the following values.

Field Type of data Value
JOB_NOTIFY_FIELD_PRINTER_NAME pBuf is a pointer to a null-terminated string containing the name of the printer for which the job is spooled. 0x00
JOB_NOTIFY_FIELD_MACHINE_NAME pBuf is a pointer to a null-terminated string that specifies the name of the machine that created the print job. 0x01
JOB_NOTIFY_FIELD_PORT_NAME pBuf is a pointer to a null-terminated string that identifies the port(s) used to transmit data to the printer. If a printer is connected to more than one port, the names of the ports are separated by commas (for example, "LPT1:,LPT2:,LPT3:"). 0x02
JOB_NOTIFY_FIELD_USER_NAME pBuf is a pointer to a null-terminated string that specifies the name of the user who sent the print job. 0x03
JOB_NOTIFY_FIELD_NOTIFY_NAME pBuf is a pointer to a null-terminated string that specifies the name of the user who should be notified when the job has been printed or when an error occurs while printing the job. 0x04
JOB_NOTIFY_FIELD_DATATYPE pBuf is a pointer to a null-terminated string that specifies the type of data used to record the print job. 0x05
JOB_NOTIFY_FIELD_PRINT_PROCESSOR pBuf is a pointer to a null-terminated string that specifies the name of the print processor to be used to print the job. 0x06
JOB_NOTIFY_FIELD_PARAMETERS pBuf is a pointer to a null-terminated string that specifies print-processor parameters. 0x07
JOB_NOTIFY_FIELD_DRIVER_NAME pBuf is a pointer to a null-terminated string that specifies the name of the printer driver that should be used to process the print job. 0x08
JOB_NOTIFY_FIELD_DEVMODE pBuf is a pointer to a DEVMODE structure that contains device-initialization and environment data for the printer driver. 0x09
JOB_NOTIFY_FIELD_STATUS adwData [0] specifies the job status. For a list of possible values, see the JOB_INFO_2 structure. 0x0A
JOB_NOTIFY_FIELD_STATUS_STRING pBuf is a pointer to a null-terminated string that specifies the status of the print job. 0x0B
JOB_NOTIFY_FIELD_SECURITY_DESCRIPTOR Not supported. 0x0C
JOB_NOTIFY_FIELD_DOCUMENT pBuf is a pointer to a null-terminated string that specifies the name of the print job (for example, "MS-WORD: Review.doc"). 0x0D
JOB_NOTIFY_FIELD_PRIORITY adwData [0] specifies the job priority. 0x0E
JOB_NOTIFY_FIELD_POSITION adwData [0] specifies the job's position in the print queue. 0x0F
JOB_NOTIFY_FIELD_SUBMITTED pBuf is a pointer to a SYSTEMTIME structure that specifies the time when the job was submitted. 0x10
JOB_NOTIFY_FIELD_START_TIME adwData [0] specifies the earliest time that the job can be printed. (This value is specified in minutes elapsed since 12:00 A.M.) 0x11
JOB_NOTIFY_FIELD_UNTIL_TIME adwData [0] specifies the latest time that the job can be printed. (This value is specified in minutes elapsed since 12:00 A.M.) 0x12
JOB_NOTIFY_FIELD_TIME adwData [0] specifies the total time, in seconds, that has elapsed since the job began printing. 0x13
JOB_NOTIFY_FIELD_TOTAL_PAGES adwData [0] specifies the size, in pages, of the job. 0x14
JOB_NOTIFY_FIELD_PAGES_PRINTED adwData [0] specifies the number of pages that have printed. 0x15
JOB_NOTIFY_FIELD_TOTAL_BYTES adwData [0] specifies the size, in bytes, of the job. 0x16
JOB_NOTIFY_FIELD_BYTES_PRINTED adwData [0] specifies the number of bytes that have been printed on this job. For this field, the change notification object is signaled when bytes are sent to the printer. 0x17

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Header Winspool.h (include Windows.h)

See also

Printing

Print Spooler API Structures

DEVMODE

FindNextPrinterChangeNotification

JOB_INFO_2

PRINTER_INFO_2

PRINTER_NOTIFY_INFO

SECURITY_DESCRIPTOR

SYSTEMTIME

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。