How to.... Question.....

P

Pete Smith

How to query the printer about out of paper or paper jam or any other error
message.
I have written a print application which does the printing.
VB.Net and .Net Framework 1.1. Windows 2000 Professional/Windows 2000
Server.
Thank you,
Pete
 
K

Ken Tucker [MVP]

Hi,

Sorry about that I posted the answer to the wrong question.

Take a look at the WMI win32_printer class. There is a Detected Error State
property which contains the info you are looking for

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_printer.asp

Dim arErrorInfo() = _
{"Unknown", "Unknown", "Other", "No Error", _
"Low Paper", "No Paper", "Low Toner", _
"No Toner", "Door Open", "Jammed", "Offline", _
"Service Requested", "Output Bin Full"}

Dim moReturn As Management.ManagementObjectCollection
Dim moSearch As Management.ManagementObjectSearcher
Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_Printer")

moReturn = moSearch.Get

For Each mo In moReturn
Dim strOut As String
Dim intError As Integer = CInt(mo("DetectedErrorState"))
strOut = String.Format("Name {0} - {1}", mo("Name"),
arErrorInfo(intError))
Trace.WriteLine(strOut)
Next


Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top