Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Printer Status
Message
From
19/09/2010 20:08:02
Sharath Shetty
Sri Krishna Consultancy Services
Mumbai, India
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Printer Status
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01481905
Message ID:
01481905
Views:
103
I want to find the printer status Like ONLINE, OFFLINE, OUT OF PAPER etc.

SYS(13) always return ready even when the printer is off ( because of spooling)

I tired the code below it shows PrinterStatus = 3 for all available printer
lcComputer = '.'
loWMIService = Getobject('winmgmts:' ;
    + '{impersonationLevel=impersonate}!\\' + lcComputer + '\root\cimv2')

*!* loInstalledPrinters = loWMIService.ExecQuery ;
    ("Select * from Win32_Printer Where PrinterStatus = '1' or PrinterStatus = '2'")

loInstalledPrinters = loWMIService.ExecQuery ;
    ("Select * from Win32_Printer ")

For Each loPrinters In loInstalledPrinters
CLEAR

? loPrinters.GetObjectText_
? loprinters.Name
 wait 
Next

RETURN
Thanks in Advance
Next
Reply
Map
View

Click here to load this message in the networking platform