locked
Reading status of Printer using COM1 and USB ports

    Question

  • Dear all...

                  I am using Windows XP and Visual Basic 2008 Express Edition. I need to read the status of printer such as connected, error, paper out, etc. Please help me to get the status of printer using COM1 and USB ports througn VB 2008 Express.

                   Thanks in Advance....
    Thanks, Bala.
    Tuesday, February 16, 2010 3:18 AM

Answers

All replies

  • Can't help you with USB and the printer protocol, but I have written a tutorial , which explains how to use the serial port (COMx).



    Everything should be made as simple as possible, but not simpler. Any fool can write code that a computer can understand. Good programmers write code that humans understand.
    Tuesday, February 16, 2010 8:37 AM
  • You can use WMI to monitor installed printers.  Here is a simple example: http://bytes.com/topic/visual-basic-net/answers/347497-how-can-i-determine-status-default-printer.  Since System.Managment provides a .NET wrapper for WMI, I presume that it can be used similarly.  Sorry, I don't have an example, but you may be able to find one using your favorite search engine.

    Dick
    Dick Grier. Author of Visual Basic Programmer's Guide to Serial Communications 4. See www.hardandsoftware.net.
    Tuesday, February 16, 2010 7:06 PM
  • Hi... Thanks for the link... But I'm using Zebra thermal printer, and with WMI the response is very late and take about 8 mins. This is very huge time for my needs... Please help me...
    Thanks, Bala.
    Wednesday, February 17, 2010 4:10 AM

  • Hi...
                 In my case, I need to check the status of printer even when other applications using the printer for printing. Is that possible if we open the COM port?
    Thanks, Bala.
    Wednesday, February 17, 2010 4:16 AM
  • WMI should take only a few seconds, at most.  I have no idea why it might take longer.  Perhaps you may want to take a closer look at your code.

    You might also try this code: http://support.microsoft.com/kb/202480 (I think this is VB6, so you would have to port it to .NET).

    You may neet to ask Zebra about this.  They may have more specific code or suggestions.

    Dick
    Dick Grier. Author of Visual Basic Programmer's Guide to Serial Communications 4. See www.hardandsoftware.net.
    Wednesday, February 17, 2010 7:04 PM