Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Printer Status
Message
From
19/09/2010 22:59:36
 
 
To
19/09/2010 20:08:02
Sharath Shetty
Sri Krishna Consultancy Services
Mumbai, India
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01481905
Message ID:
01481926
Views:
50
VFP returns the status of Windows print queue, not the actual printer.

>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
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Reply
Map
View

Click here to load this message in the networking platform