Hi M,
Based on my understanding, you'd like to detect the printer's status before
you print a document. If I'm off base, please feel free to let me know.
I am not SNMP expert, so I couldn't give you any assistance on SNMP.
The status of printers and print jobs are updated by the Win32 Spooler
during the despool of a print job. All other time, when that printer is not
despooling and resports no state information, the printer is considered to
be ready and idle. It means that if there's no print job in the print
queue, we have no way to get the real status of the physical printer.
To determine the state of a physical printer, there is one fundamental
premise that must be true: the Spooler must be attempting to send a print
job to the physical printer. This is the only time the state of the printer
is reported by the port monitor. In addition, the most meaningful
information may be reported in the status members of a JOB_INFO structure
for that particular print job because some port monitor will have set these
values directly.
For more information on how to get the status of a printer and a print job,
you may visit the following KB article.
'How to get the status of a printer and a print job'
http://support.microsoft.com/kb/160129/en-us
Hope this helps.
If you have any question, please feel free to let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
lockness - 19 Jun 2007 11:06 GMT
Hi
I don't want to attempt a print and have it fail, so a status query on the
spooler
is ruled out. MS provide a SNMP API and a way for SNMP to become a feeder
to the WMI system but both these approaches take some setting up, so
they're ruled out.
What I found eventually is http://www.codeproject.com/useritems/SNMPDLL.asp
Make a reference to SNMPDll and TableReader.
Imports SNMPDll
Imports Org.Snmp
agent = New SNMPAgent("192.168.1.65")
snmp = New SNMPObject("1.3.6.1.2.1.25.3.5.1.1.1")
Me.btnCheckPrinter.Text = snmp.getSimpleValue(agent)
192.168.165 is the adress of the printer.
1.3.6.1.2.1.25.3.5.1.1.1 is the OID for the printer status. I found this by
browsing the printer with a SNMP manager program.
And that's it. Now I know instantly what state the printer is in.
M.
> Hi M,
>
[quoted text clipped - 49 lines]
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
Linda Liu [MSFT] - 21 Jun 2007 10:38 GMT
Hi M,
Thank you for your feedback on how you succeed in solving this problem
using SNMP.
I think it will definitely benefit other readers in the newsgroup.
If you have any other questions in the future, please don't hesitate to
contact us.
Have a nice day!
Sincerely,
Linda Liu
Microsoft Online Community Support