Düzenle

Aracılığıyla paylaş


PRINTER_INFO_2 structure

The PRINTER_INFO_2 structure specifies detailed printer information.

Syntax

typedef struct _PRINTER_INFO_2 {
  LPTSTR               pServerName;
  LPTSTR               pPrinterName;
  LPTSTR               pShareName;
  LPTSTR               pPortName;
  LPTSTR               pDriverName;
  LPTSTR               pComment;
  LPTSTR               pLocation;
  LPDEVMODE            pDevMode;
  LPTSTR               pSepFile;
  LPTSTR               pPrintProcessor;
  LPTSTR               pDatatype;
  LPTSTR               pParameters;
  PSECURITY_DESCRIPTOR pSecurityDescriptor;
  DWORD                Attributes;
  DWORD                Priority;
  DWORD                DefaultPriority;
  DWORD                StartTime;
  DWORD                UntilTime;
  DWORD                Status;
  DWORD                cJobs;
  DWORD                AveragePPM;
} PRINTER_INFO_2, *PPRINTER_INFO_2;

Members

pServerName

A pointer to a null-terminated string identifying the server that controls the printer. If this string is NULL, the printer is controlled locally.

pPrinterName

A pointer to a null-terminated string that specifies the name of the printer.

pShareName

A pointer to a null-terminated string that identifies the share point for the printer. (This string is used only if the PRINTER_ATTRIBUTE_SHARED constant was set for the Attributes member.)

pPortName

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 each port must be separated by commas (for example, "LPT1:,LPT2:,LPT3:").

pDriverName

A pointer to a null-terminated string that specifies the name of the printer driver.

pComment

A pointer to a null-terminated string that provides a brief description of the printer.

pLocation

A pointer to a null-terminated string that specifies the physical location of the printer (for example, "Bldg. 38, Room 1164").

pDevMode

A pointer to a DEVMODE structure that defines default printer data such as the paper orientation and the resolution.

pSepFile

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.

pPrintProcessor

A pointer to a null-terminated string that specifies the name of the print processor used by the printer. You can use the EnumPrintProcessors function to obtain a list of print processors installed on a server.

pDatatype

A pointer to a null-terminated string that specifies the data type used to record the print job. You can use the EnumPrintProcessorDatatypes function to obtain a list of data types supported by a specific print processor.

pParameters

A pointer to a null-terminated string that specifies the default print-processor parameters.

pSecurityDescriptor

A pointer to a SECURITY_DESCRIPTOR structure for the printer. This member may be NULL.

Attributes

The printer attributes. This member can be any reasonable combination of the following values.

Value Meaning
PRINTER_ATTRIBUTE_DIRECT Job is sent directly to the printer (it is not spooled).
PRINTER_ATTRIBUTE_DO_COMPLETE_FIRST If set and printer is set for print-while-spooling, any jobs that have completed spooling are scheduled to print before jobs that have not completed spooling.
PRINTER_ATTRIBUTE_ENABLE_DEVQ If set, DevQueryPrint is called. DevQueryPrint may fail if the document and printer setups do not match. Setting this flag causes mismatched documents to be held in the queue.
PRINTER_ATTRIBUTE_HIDDEN Reserved.
PRINTER_ATTRIBUTE_KEEPPRINTEDJOBS If set, jobs are kept after they are printed. If unset, jobs are deleted.
PRINTER_ATTRIBUTE_LOCAL Printer is a local printer.
PRINTER_ATTRIBUTE_NETWORK Printer is a network printer connection.
PRINTER_ATTRIBUTE_PUBLISHED Indicates whether the printer is published in the directory service.
PRINTER_ATTRIBUTE_QUEUED If set, the printer spools and starts printing after the last page is spooled. If not set and PRINTER_ATTRIBUTE_DIRECT is not set, the printer spools and prints while spooling.
PRINTER_ATTRIBUTE_RAW_ONLY Indicates that only raw data type print jobs can be spooled.
PRINTER_ATTRIBUTE_SHARED Printer is shared.

In Windows XP and later versions of Windows, the following value can also be used.

Value Meaning
PRINTER_ATTRIBUTE_FAX If set, printer is a fax printer. This can only be set by AddPrinter, but it can be retrieved by EnumPrinters and GetPrinter.

In Windows Vista and later versions of Windows, the following values can also be used.

Value Meaning
PRINTER_ATTRIBUTE_FRIENDLY_NAME A computer has connected to this printer and given it a friendly name.
PRINTER_ATTRIBUTE_MACHINE Printer is a per-machine connection.
PRINTER_ATTRIBUTE_PUSHED_USER The printer was installed by using the Push Printer Connections user policy.
PRINTER_ATTRIBUTE_PUSHED_MACHINE The printer was installed by using the Push Printer Connections computer policy.

In Windows Server 2003, the following value can also be used.

Value Meaning
PRINTER_ATTRIBUTE_TS Indicates the printer is currently connected through a terminal server.

Priority

A priority value that the spooler uses to route print jobs.

DefaultPriority

The default priority value assigned to each print job.

StartTime

The earliest time at which the printer will print a job. This value is expressed as minutes elapsed since 12:00 AM GMT (Greenwich Mean Time).

UntilTime

The latest time at which the printer will print a job. This value is expressed as minutes elapsed since 12:00 AM GMT (Greenwich Mean Time).

Status

The printer status. This member can be any reasonable combination of the following values.

Value Meaning
PRINTER_STATUS_BUSY The printer is busy.
PRINTER_STATUS_DOOR_OPEN The printer door is open.
PRINTER_STATUS_ERROR The printer is in an error state.
PRINTER_STATUS_INITIALIZING The printer is initializing.
PRINTER_STATUS_IO_ACTIVE The printer is in an active input/output state
PRINTER_STATUS_MANUAL_FEED The printer is in a manual feed state.
PRINTER_STATUS_NO_TONER The printer is out of toner.
PRINTER_STATUS_NOT_AVAILABLE The printer is not available for printing.
PRINTER_STATUS_OFFLINE The printer is offline.
PRINTER_STATUS_OUT_OF_MEMORY The printer has run out of memory.
PRINTER_STATUS_OUTPUT_BIN_FULL The printer's output bin is full.
PRINTER_STATUS_PAGE_PUNT The printer cannot print the current page.
PRINTER_STATUS_PAPER_JAM Paper is jammed in the printer
PRINTER_STATUS_PAPER_OUT The printer is out of paper.
PRINTER_STATUS_PAPER_PROBLEM The printer has a paper problem.
PRINTER_STATUS_PAUSED The printer is paused.
PRINTER_STATUS_PENDING_DELETION The printer is being deleted.
PRINTER_STATUS_POWER_SAVE The printer is in power save mode.
PRINTER_STATUS_PRINTING The printer is printing.
PRINTER_STATUS_PROCESSING The printer is processing a print job.
PRINTER_STATUS_SERVER_UNKNOWN The printer status is unknown.
PRINTER_STATUS_TONER_LOW The printer is low on toner.
PRINTER_STATUS_USER_INTERVENTION The printer has an error that requires the user to do something.
PRINTER_STATUS_WAITING The printer is waiting.
PRINTER_STATUS_WARMING_UP The printer is warming up.

cJobs

The number of print jobs that have been queued for the printer.

AveragePPM

The average number of pages per minute that have been printed on the printer.

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)
Unicode and ANSI names
_PRINTER_INFO_2W (Unicode) and _PRINTER_INFO_2A (ANSI)

See also

Printing

Print Spooler API Structures

DEVMODE

EnumPrinters

PRINTER_INFO_1

PRINTER_INFO_3

PRINTER_INFO_4

SECURITY_DESCRIPTOR