typedef struct tagPRINTER { /* prt */
DWORD cVersion;
LPPRINTERSERVER lpPrinterServer;
LPTSTR lpPrinterName;
LPTSTR lpPortName;
LPTSTR lpDriverName;
LPTSTR lpComment;
LPTSTR lpLocation;
LPDEVMODE lpDevMode;
LPTSTR lpSepFile;
LPTSTR lpPrintProcessor;
LPTSTR lpDatatype;
LPTSTR lpParameters;
LPTSTR lpVendorData;
DWORD Attributes;
DWORD Priority;
DWORD DefaultPriority;
SYSTEMTIME StartTime;
SYSTEMTIME UntilTime;
DWORD Status;
DWORD cJobs;
DWORD AveragePPM;
} PRINTER;
The PRINTER data structure contains all of the information about a printer.
cVersion
Specifies this structure's version number. This allows the system to deal with future compatibility issues. For Win32, set this field to 32.
lpPrinterServer
Pointer to a PRINTERSERVER data structure that describes the printer server where this printer resides. This is network vendor specific, and was typically generated by calling EnumPrinterServers. If this value is NULL, then the printer is a local printer.
lpPrinterName
Pointer to a string that is the name of the printer.
lpPortName
Pointer to a string that is the name of the port this printer is connected to.
lpDriverName
Pointer to a zero-terminated string that names the printer's printer driver. Printer driver names have the form Driver.Model, with both the prefix and suffix parts of the name following standard file system naming conventions.
lpComment
Pointer to a string that describes the printer.
lpLocation
Pointer to a string that describes where the printer physically resides.
lpDevMode
Pointer to a default DEVMODE structure assigned to print jobs for this printer that do not specify a DEVMODE structure when the print job is created.
lpSepFile
Indicates the fully qualified path name to the separator file used to produce banner pages for this printer.
lpPrintProcessor
Pointer to a string that is the name of a default print processor assigned to print jobs for this printer that do not specify a print processor when the print job is created.
lpDatatype
Pointer to a string that names a default data type assigned to print jobs for this printer that do not specify a data type when the print job is created.
lpParameters
Pointer to a string that contains default print processor parameters assigned to print jobs for this printer that do not specify print processor parameters when the print job is created.
lpVendorData
Pointer to a VENDORDATA structure that contains network vendor specific data.
Attributes
Specifies the attributes of the printer. Consists of a set of bit flags. The following values have meaning:
Value | Meaning |
QUEUED | The printer spools print jobs sent to it. |
DIRECT | The printer does not spool print jobs sent to it. |
Since Attributes consists of a set of bit flags, a printer can simultaneously be defined as QUEUED and DIRECT. In this situation, the printer will spool print jobs sent to it, and at the same time another thread will be reading the spool file and sending data to the physical printer.
Priority
Specifies a priority assigned to the printer. This value is used to schedule print jobs when multiple printers are connected to a single port.
DefaultPriority
Specifies a default priority assigned to print jobs for this printer that do not specify a priority when the print job is created. A value of 1 indicates highest priority.
StartTime
Specifies the earliest time at which jobs can be printed from this printer.
UntilTime
Specifies the latest time at which jobs can be printed from this printer.
Status
Specifies the state of the printer. Consists of a set of bit flags.
If the value is zero — that is, no bit flags are set — the printer is idle, with no errors, waiting for a print job.
The following values have meaning:
Value | Meaning |
PRINTER_PRINTING | The printer is printing. |
PRINTER_PAUSED | The printer is paused. |
PRINTER_ERROR | The printer is in error. |
PRINTER_OFF-LINE | The printer is off-line |
PRINTER_PAPEROUT | The printer is out of paper. |
cJobs
Specifies the number of print jobs waiting to print.
AveragePPM
Specifies the average number of pages per minute that this printer has printed. This number is multiplied by one thousand.
DEVMODE, JOB