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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

App Locks up after Opening LPT as File, Printing, then Closing

Status
Not open for further replies.

VolMac

Programmer
Oct 29, 1998
4
UY
If I OPEN LPT1 as a file (#1), PRINT to it, then Close (#1), the application locks up on the execution of the Close statement. I have to use Ctrl/Alt/Del to close the app after the lockup. The development and target systems are Win 95. Following is a very short program that I tested with.<br>
<br>
Private Sub Form_Load()<br>
Open "LPT1:" For Output As #1 ' Dot Matrix<br>
Print #1, "Test"<br>
Close #1<br>
End Sub<br>
<br>
I have seen this lockup running the program in the VB5 IDE and as an EXE. I can duplicate the problem on multiple PCs. I have tried removing the Win 95 printer drivers that use LPT1. There no conflicts listed under 'System Hardware/Printers'. On one of the test systems LPT1 is built into the Motherboard. On another system LPT1 is an ISA Card.<br>
<br>
Has anyone seen this problem or have any suggestions on how to correct it?
 
VolMac,<br>
<br>
May be able to provide some 'contributory' data, but can't say how relevant it might be to a solution. At work, we have an expense report application that was originally created in dBase II, upgraded to dBase III, then converted to a (primitive) VB application, prolly late version 1.0 or early 2.0. This app allows of only two printer types, an HP LaserJet II (or above works), or any other (presumably dot matrix). However, the printer, in Windows (from 3.0 forward) _must_ be named LPT1. If you try to install a printer under Win95/98, you cannot name it LPT1 in the installation process - you have to name it something else, then rename it after the installation. Point here being that I don't _think_ you can make "Open LPT1:" work because Windows intercepts the call and gets *very* confused. Is it possible that you could use the printer object in VB instead? I've had reasonable success with that as long as the output was not overly complicated. I just had to remember to issue an EndDoc - which usually I forgot to do &lt;grin!&gt;.<br>
<br>
Make a good day . . .
 
databarn,<br>
Thanks for the info, I will try renaming the Win 95 printer to LPT1.<br>
<br>
I have tried using the Printer object but have had limited success. I am porting some code from another DOS BASIC application that has many subroutines written for printer configuration using the OPEN, PRINT, CLOSE statements.<br>
<br>
The problem with the printer object is that it does not seem to send unprintable ASCII codes (0-31), specifically the Escape character (ASCII 27), correctly. When I execute <br>
'Printer.Print Chr(27);"@"; ' to Initialize the printer, the printer prints a garbage character and @ instead of initializing the printer.<br>
<br>
I have to get one of the two approaches working, so I thought I'd start with the one that would that would hopefully require the least amount of recoding.
 
VolMac,<br>
<br>
You might try examining the archves at VISBAS-L (For subscription/signoff info and archives, see .). It's one of several VB mailing lists I'm on, and there's some really good stuff there, as well as some that's pretty trivial (read _really_ newbie &lt;grin!&gt;). Don't advise joining if you can't handle a lot of volume (1-300 posts per day - even the digests get huge.), but the archives are simply awesome. <br>
<br>
Another source might be PCSOFT (PCSOFT mailing list - Bob Wright:nospin@nospin.com - Drew Dunn:me@myself.com). Don't know if they maintain an archive, but the mail volume is not all that high, so joining for a few days might be helpful.<br>
<br>
Sorry I cannot be of any real help, but the lists above may be able to provide what I cannot not.<br>
<br>
Make a good day . . .<br>
 
databarn,<br>
<br>
Thanks again for the help, I'll look at those sources.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top