Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting Windows Printer Status
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Getting Windows Printer Status
Miscellaneous
Thread ID:
01285750
Message ID:
01285750
Views:
82
Is there any way I can get accurate status of Windows Printers (and possibly the "Qty of Documents" pending) from Windows "Printers & Faxes" page ?

I have already tried:

objWMIService = Getobject("winmgmts:"+ "{impersonationLevel=impersonate}!\\" + strComputer + "\root\cimv2")
colInstalledPrinters = objWMIService.ExecQuery("SELECT * FROM Win32_Printer")
For Each objPrinter In colInstalledPrinters
Do Case
Case objPrinter.PrinterStatus = 1
strPrinterStatus = "Offline" && "Other"
Case objPrinter.PrinterStatus = 2
strPrinterStatus = "Online" && "Unknown"
Case objPrinter.PrinterStatus = 3
strPrinterStatus = "Ready" && "Idle"
Case objPrinter.PrinterStatus = 4
strPrinterStatus = "Printing"
Case objPrinter.PrinterStatus = 5
strPrinterStatus = "Warmup"
ENDCASE
NEXT

But this returns bogus results. For example it returns

objPrinter.PrinterStatus = 3 (defined as Idle)

when the the printer status actually indicates "Error" in Windows Printers page.

I need something more reliable so that I can accurately evaulate Printer status.

Thanks.
Cyrus Nima
-------------------
cyrusnima@gmail.com
Next
Reply
Map
View

Click here to load this message in the networking platform