Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to determine whether lpt1 can be used to print?

Status
Not open for further replies.

avisemah

Programmer
Mar 11, 2004
2
US
Hi,

I have a VB application that is reuired to open a register drawer that
is connected to en epson tm-822 printer, which, in turn, is connected
to LPT1. When the printer and the drawer are connected there is no
problem and everything works fine. However, there are some cases when
the printer is not connected (i.e, remote site). In such case once VB
executes the code lines responsible for opening the drawer, the
application freezes, which forces me to kill V VB instance through the
task manager. I think I have an idea what needs to be done, and if
I'm right, then I don't know how to do it. To be more specific, I
think I need to check whether the printer and/or the drawer is
connected. If the printer is connected, I just execute the code
responsible for opening the register. If it's not connected, then I
skip the process of opening the register. In short, it all boils down
to figuring out whether LPT1 port is connected to the printer. Does
anyone have any idea what exactly I have to do. I came across
port32.dll or winsock.dll, and if that may do the trick for me, then I
would be greatly appreciative if someone pointed to me how to employ
either one of those dll. The following is the code that opens the
drawer.

Open "LPT1" For Output As #1
Print #1, Chr(27) & Chr(112) & Chr(0) & Chr(25) & Chr(250)
Close #1


Thank You In advance

Avi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top