×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

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

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

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

(OP)
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.

Private Sub Form_Load()
Open "LPT1:" For Output As #1 ' Dot Matrix
Print #1, "Test"
Close #1
End Sub

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.

Has anyone seen this problem or have any suggestions on how to correct it?

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

VolMac,

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 <grin!>.

Make a good day . . .

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

(OP)
databarn,
Thanks for the info, I will try renaming the Win 95 printer to LPT1.

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.

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
'Printer.Print Chr(27);"@"; ' to Initialize the printer, the printer prints a garbage character and @ instead of initializing the printer.

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.

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

VolMac,

You might try examining the archves at VISBAS-L (For subscription/signoff info and archives, see http://peach.ease.lsoft.com/archives/visbas-l.html .). 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 <grin!>). 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.

Another source might be PCSOFT (PCSOFT mailing list - http://nospin.com 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.

Sorry I cannot be of any real help, but the lists above may be able to provide what I cannot not.

Make a good day . . .

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

(OP)
databarn,

Thanks again for the help, I'll look at those sources.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close