Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Another approach of printer online
Message
De
04/12/2009 18:12:18
 
 
À
04/12/2009 17:47:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01436991
Message ID:
01437730
Vues:
35
Many Thanks!

>Try Google... "WMI tutorial" gives many good links. The same goes for "WMI white paper"
>
>>By the way!
>>Where can I get good stuff about WMI?
>>
>>>You're welcome. WMI is really great, you can use it to find a lot of useful and useless information. :-)
>>>
>>>>Hi Tore!
>>>>It's just and exercise. I'm not trying to know exactly the
>>>>status of the printer. I just want to know how to use WMI
>>>>to get that status. Training and knowing WMI.
>>>>Thanks!
>>>>
>>>>>If you check carefully, you will find that Windows' Printer and Faxes does NOT always show the correct status of the printer either. So to repeat what others have told you, you are wasting your time, there is no 100% accurate way to determine the printer status.
>>>>>
>>>>>>Thanks!
>>>>>>But, if the printer is "offline" it stills saying that
>>>>>>the printer is "Idle".
>>>>>>
>>>>>>
>>>>>>>
>>>>>>>This should give you the correct status of the printer:
>>>>>>>
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
***
TONY Nascimento
*****************

"Your mind is like a parachute. It only works if it is open" - Anthony J. D'Angelo

"The desire to know is natural to good men" - Leonardo da Vinci
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform