Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General 2 / July 2008



Tip: Looking for answers? Try searching our database.

Printing From DOS application To A Windows Printer

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John Simpson - 11 Jul 2008 21:04 GMT
OK, Gurus, my thanks in advance for any insight.

There are a couple of shareware programs out there (DOS2USB, and DOSPRN)
that will allow printing to a Windows printer from a legacy DOS application.
In my case I wrote a boat rental application in Cobol back in the '80's, and
now the customer wants to migrate it to a new PC that has USB but no
parallel or serial ports. I've written a VB version of it, but it's a
complex application and has not been tested nearly enough to go live.

I bought DOS2USB, but got burned by the not-too-good-English-speaking sales
folks overseas, but that's another story.

I must have too much time on my hands, 'cause I want to write my own
utility. An easy way would be to create a text file in the DOS application,
look for its existence, then read and print it from a VB program, and
finally delete it, but I consider this a sloppy solution to the problem.

I've Googled myself silly, and cannot find a method of doing this the hard
way. The question: Is there a way, and I'm sure there is, to read the print
data from a register or DOS printer memory area (if this exists), into a
string in VB? If so, is it accessed a bit at a time, or a byte at a time, or
would I be lucky enough to be able to read a line to a CRLF? Is it at 378H?
Can anyone give me a brief code example of how to loop through this data?
Once into a VB string, it's a piece of cake, but I have no clue how to get
to that point.

Thanks.

John
Jason Keats - 12 Jul 2008 05:16 GMT
> OK, Gurus, my thanks in advance for any insight.
>
[quoted text clipped - 27 lines]
>
> John

You can get PRN2FILE from
http://homepages.rootsweb.ancestry.com/~fhcnet/fhctech/print2file.html
which will allow you to capture the printout from a DOS program to a file.

You may then be able to parse the file and recreate the features of a
program like Printfile
http://www.printfil.com/english.htm

Alternatively, some general information can be found here
http://www.columbia.edu/~em36/wpdos/winprint.html

which suggests you may be able to use this
http://www.lerup.com/printfile/
to print the captured file via Windows.

HTH
John Simpson - 16 Jul 2008 22:25 GMT
>> OK, Gurus, my thanks in advance for any insight.
>>
[quoted text clipped - 44 lines]
>
> HTH

Thanks for the info.

John
Johan Bechthum - 14 Jul 2008 12:46 GMT
I still use an old DOS program that prints to the LPT1 port.

There is no local printer on my computer anymore, but I have to use the
network printer (similar problem).

In the Properties-box of the printer I checked the virtual printer port
(obvious) and the LPT1-port, using Printer spooling. That way everything
printed to LPT1 is sent to the virtual port (in your case the USB port).

Hope this helps,

Johan.

> OK, Gurus, my thanks in advance for any insight.
>
[quoted text clipped - 27 lines]
>
> John
John Simpson - 16 Jul 2008 22:33 GMT
>I still use an old DOS program that prints to the LPT1 port.
>
[quoted text clipped - 40 lines]
>>
>> John

Thanks. I never would've thought to select two ports, but that does solve a
printing problem that I've had for a long time.

This does not solve my original problem, because the Cobol system 'sees'
that there is no physical LPT ports and errors out. Now, I need to find the
spooled print file, read it, and print it with a VB program after I create
files in the Cobol programs.

John
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.