http://www.cnblogs.com/menlsh/p/4211988.html
BOOL
GetPrinter(
HANDLE
hPrinter,
// handle to printer
DWORD
Level,
// information level
LPBYTE
pPrinter,
// printer information buffer
DWORD
cbBuf,
// size of buffer
LPDWORD
pcbNeeded
// bytes received or required
);
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;
Status
Specifies the printer status. This member can be any reasonable combination of the following values. Value MeaningPRINTER_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.
Windows 95/98/Me: Indicates the page is being "punted" (that is, not printed) because it is too complex for the printer to print.
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.