How to verify printer status in Lpt1

How to verify if printer is turn on or turn off in port lpt1.
The code to print is:

open "lpt1" for output as #1
print "....."
close #1

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

VBGuruConnect With a Mentor Commented:
There are two ways you can do this. Depending on your convenience you do.

1. VB doesn't allow you to check the printer port status diectly so you can use some of the ocxs available in the maraket to check the status of the port and know the status. Some of the links you can check out:

2. Windows provides some of the API calls using which you can know the status of the printer. Some of the APIs are GetPrinter which can return the information about the printer in any of a PRINTER_INFO_1, PRINTER_INFO_2, PRINTER_INFO_3, PRINTER_INFO_4, or PRINTER_INFO_5 structures.
As I don't have specific examples using thase API calls I can't help you with the example
This is NOT how to do printer I/O in VB!

You should print to the logical PRINTER device and let windows do the direct management of the printer. If you use your method you'll be unable to print to network or other shared printers. Additionally you run the possibility of interfering with a "normal" windows job.

Dim x As Printer

'select a printer
For Each x In Printers
    If UCase(x.DeviceName) = "PRINTERNAME" Then
        Set Printer = x
    End If    
Next x
All Courses

From novice to tech pro — start learning today.