Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Check printer status
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01222937
Message ID:
01222990
Vues:
20
>How Check printer status (ON/OFF) in VFP 9 ?
>
>as far as I not it was not possible to check real printer status in former versions

Try this.
strComputer = "."
objWMIService = Getobject("winmgmts:"+ "{impersonationLevel=impersonate}!\\" + strComputer + "\root\cimv2")
colInstalledPrinters = objWMIService.ExecQuery("SELECT * FROM Win32_Printer")
For Each objPrinter In colInstalledPrinters
?"Name: " + objPrinter.Name
Do Case
Case objPrinter.PrinterStatus = 1
strPrinterStatus = "Other"
Case objPrinter.PrinterStatus = 2
strPrinterStatus = "Unknown"
Case objPrinter.PrinterStatus = 3
strPrinterStatus = "Idle"
Case objPrinter.PrinterStatus = 4
strPrinterStatus = "Printing"
Case objPrinter.PrinterStatus = 5
strPrinterStatus = "Warmup"
Endcase
? "Printer Status: " + strPrinterStatus
Next
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform