PC Review
Forums
Newsgroups
Windows XP
Windows XP WMI
WMI to detect printer online/offline
Forums
Newsgroups
Windows XP
Windows XP WMI
WMI to detect printer online/offline
![]() |
WMI to detect printer online/offline |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi,
Sorry for this long preamble, but it will help with my question.... I'm developing a dedicated XP Embedded application. If the user prints fom the application, but no printer is available, a typical "printer offline" dialog will appear (Printer dependent, in my case a Canon i550). This is undesirable, the customer wants it just to ignore the print request, and no dialog ever be visible. For this reason, I want to detect if the printer is Online/offline BEFORE attempting to print. If offline, I can then abort the print, and won't see the dialog. The Win32 API's "OpenPrinter" etc. seem to work on the spooler queue, rather than the printer itself, and will only report the printer offline AFTER a dcoument is sent, whichis too late, because I will then see the dialog. It seems that I could use WMI. I've tried using GetObject(sPrinter).InstancesOf("win32_Printer") and then looking at Printer.PrinterStatus, but the same effect is seen as with Win32 API. So, the question is, how can I tell if a printer is offline/online without sending a print to it? I think I have to use WMI extensions to the printer WDM driver? Any pointers, advice recieved with thanks! Andy Foster |
|
|
|
#2 |
|
Guest
Posts: n/a
|
You would need to force a port status update to set the printer status.
This is assuming that the Port is a Standard TC/IP Port with SNMP enabled. -- Alan Morris Windows Printing Team Search the Microsoft Knowledge Base here: http://support.microsoft.com/default.aspx?scid=fh;[ln];kbhowto This posting is provided "AS IS" with no warranties, and confers no rights. "Andy Foster" <nospam@nospam.com> wrote in message news:uoAQaJwhEHA.4092@TK2MSFTNGP10.phx.gbl... > Hi, > > Sorry for this long preamble, but it will help with my question.... > > I'm developing a dedicated XP Embedded application. > > If the user prints fom the application, but no printer is available, a > typical "printer offline" dialog will appear (Printer dependent, in my case > a Canon i550). This is undesirable, the customer wants it just to ignore the > print request, and no dialog ever be visible. > > For this reason, I want to detect if the printer is Online/offline BEFORE > attempting to print. If offline, I can then abort the print, and won't see > the dialog. > > The Win32 API's "OpenPrinter" etc. seem to work on the spooler queue, rather > than the printer itself, and will only report the printer offline AFTER a > dcoument is sent, whichis too late, because I will then see the dialog. > > It seems that I could use WMI. I've tried using > GetObject(sPrinter).InstancesOf("win32_Printer") > > and then looking at Printer.PrinterStatus, but the same effect is seen as > with Win32 API. > > > > So, the question is, how can I tell if a printer is offline/online without > sending a print to it? > > I think I have to use WMI extensions to the printer WDM driver? > > Any pointers, advice recieved with thanks! > > Andy Foster > > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

