Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting Windows Printer Status
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Getting Windows Printer Status
Divers
Thread ID:
01285750
Message ID:
01285750
Vues:
83
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform