
| Last Modification: December 11, 1999 |
How can I determine the status of the printer programmatically?
The answer has several parts. The good part is that calling GetPrinter() at
level 2 will return the printer status in PRINTER_INFO_2::Status. The bad part
is twofold: While on Win9x you can get detailed information of the printer
status in this member, on WinNT you'll only find out if the printer is paused or
pending deletion, which is obviously not enough.
To further complicate things, it turns out that Windows only queries the
printer for its status when there's a print job for the it, which means that if
you are not printing you probably can't find out the real printer status.
If you are not concerned about this, you'll be glad to know that you can obtain
the same information on WinNT and Win9x by querying the print job instead of the
printer for the status, via the GetJob() api.
References and samples: