PRINTER_INFO_2

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, *LPPRINTER_INFO_2;

This structure describes the settings of a Printer.

Members

pServerName

This value points to a NULL terminated string. Its value defines the location of where this Printer is defined. If the Pointer is NULL, then it is defined locally.

pPrinterName

This value points to a NULL terminated string. Its value defines the name of the Printer.

pShareName

This value points to a NULL terminated string. Its value defines the Name of the Print Share, iff the Attributes field has a bit setting of PRINTER_ATTRIBUTE_SHARED.

pPortName

This value points to a NULL terminated string. Its value defines the port(s) that this Printer is connected to. The valid port names can be retrieved by calling EnumPorts. A Printer could be connected to more than one port, in which case the names are concatenated separated by a comma. ie LPT1:,LPT2:,LPT3:

pDriverName

This value points to a NULL terminated string. Its value defines the name of the Printer Driver that this Printer is to use. The valid list of DriverNames can be retrieved from EnumPrinterDrivers.

pComment

This value points to a NULL terminated string. Its value defines a Comment giving a brief description of the Printer. ie “Fast Printer for the Marketing Group”

pLocation

This value points to a NULL terminated string. Its value describes the physical location of the Printer. ie “Building 2 Room 1004”

pDevMode

This value points to a NULL terminated string. Its value defines the DEVMODE structure to use by default for any Print Jobs. The DEVMODE structure can define the Orientation – Portrait or Landscape, the resolution etc etc.

pSepFile

This value points to a NULL terminated string. Its value defines the Separator Page used to seperate Jobs sent to a Printer.

pPrintProcessor

This value points to a NULL terminated string. Its value defines the Print Processor to use by default for this Printer. Valid Print Processors can be retrieved using the EnumPrintProcessors function.

pDatatype

This value points to a NULL terminated string. Its value defines the default Datatype to use for this Printer. Normally this will be NULL, or “RAW”.

pParameters

This value points to a NULL terminated string. Its value defines the default Parameters to be used to a Print Processor.

pSecurityDescriptor

This value points to a SECURITY_DESCRIPTOR. Its value defines the access rights of all users to this Printer.

Attributes

This value is a bit-field. The following values are valid:

PRINTER_ATTRIBUTE_QUEUED PRINTER_ATTRIBUTE_DIRECT PRINTER_ATTRIBUTE_DEFAULT PRINTER_ATTRIBUTE_SHARED

Priority

This value specifies the relative Priority of the Printer. When two or more printers are connected to the same port, the spool subsystem will use the priority to decide which Job from which Printer should Print next.

DefaultPriority

This value defines the default priority associated with each job.

StartTime

This value specifies the earliest time that this printer will print.

UntilTime

This value specifies the latest time that this printer will print. Note: Jobs can still be spooled to the Printer, but no jobs will be printed before StartTime and after UntilTime

Status

This value is a bit-field. The following values are valid:

PRINTER_STATUS_PAUSED PRINTER_STATUS_PENDING_DELETION

cJobs

This value specifies the number of jobs that are waiting to be printed on this Printer.

AveragePPM

This value specifies the average number of Pages that have been printed per minute on this Printer.