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

Printing from a DOS app.

Status
Not open for further replies.

walker2

Programmer
Oct 28, 2006
43
DK
My dad is using an older DOS DPMI program for acounting.
Until recently it worked fine under Win ME.

On his new PC he is running XP prof. and the software as such works fine.
The problem comes, when he wants to print something. At times it works fine and at other times the Windows spooler crashes, leaving some spool files behind.

The printer used is a Brother HL-5040, but inside the DOS app. it is set up as a HP Laserjet 4.

Under ME it might have worked, because it allows direct hardware access to tle LPT1 port, which XP has sealed off.
But why does it work on and off now?

And how can I make a stable system that works in both accounting and normal Windows?

I have quite some Delphi programming experience so work-arounds like setting the acounting app. to export spool files instead, capturing them in a Delphi app, sending it to the printer, and finally deleting the file, could be a solution.

But are ther better ones?

The newest additions to the above:
I have tried installing a LaserJet 4 driver: No change. (Works fine i8n Windows and on/off in DOS DPMI)
I have tried changing the interface in the DOS app. to using no esc sequences: No change

It looks like the first few minutes after Windows start, I can print OK from within the app.
After that or if I print from a Windows app. first, forget it! :-(
 
First: make sure you have an XP edition of the printer driver. Download a new driver from the Brother site. If it is zipped or compressed, unzip it to a new folder.

Second: Remove/uninstall the printer.
Start, Printers and Faxes, right-click and Delete the printer defined there.

Third: Clean the printer driver remnants. This step is very important.
See MS-MVP Bruce Sanderson's discussion of how to do this:

Fourth: Reinstall the Printer.
Start, Printers and Faxes, reinstall the printer using your new driver set (from Step #1).

Other possible issues & workarounds:




____________________________
Users Helping Users
 
Have you tried using the Compatibility Mode to run these programs in the Windows 98/ Windows ME Mode?

printer problem
thread779-279009

DOS programs not printing in XP
thread779-688514

DOS Program under XPpro, USB Printer
thread779-335131
 
bcastner:
I have downloaded the latest driver from Brother.

That cleanup you mention migth be an idea. I may have more than one set of registry entries floating around.

I now have writen a working, though not too smart, app. that captures the spool file, I can choose as output instead of direct to printer. It also converts our somewhat strange Danish characters while it is at it. The build-in converter in the accounting app. does not seem to work too well under Windows.
I now wonder how to put it into the systray only. Or better still, make it completely invisible. (service maybe?)
It needs a timing device, and that seems to require a form of some sort.
It now starts up minimized, but ...

linney:
I have tried various compatibility modes. No luck so far.
 
What I have done before is to change the output from the DOS program to lpt2:, then in XP reconfigure the printer port from lpt1: to lpt2:. Windows will still print to the line printer because it is the default and it doesn't care about port names lpt1 or lpt2. Your DOS program should then print to the local printer. As for the HP LaserJet 4 definition, this is a laser standard used by most manufacturers as a default and should drive your printer up to a point. Special character sets will have to be dealt with as you have done i.e. your translation program.

Regards,
David.
 
DTracy
That does sound like a fair solution.
Deep down tricky, though ;-)

In the DPMI app. I can easily change the default printer's default output port.
It can also convert the Danish chars to other numbers. Within the 0-255, however. And not all seem to be converted that way. Some seem to be 'hardwired'.

Just to be sure: How do I reroute the hardware in XP?
Would Device Manager under My Computer do the trick?
It looks like I can change the printerport as described, but is that it?
 
I don't think Mr. Castner's link applies to your problem, perhaps a mistake in posting.

Ok-
Use the device manager, ports, printer port lpt1, and in the listbox select lpt2 for the current port. Then just make a new printer definition for your printer (Add Printer) and use local connection, set the port to lpt2. Test, you should be able to "copy mytest.txt lpt2" in the command window where mytest.txt is any text file. That should do it.

Let us know how this works out.
Regards,
David.
 
Thanks DTracy.

The reason that lpt1 is an issue is that it is a protected resource if the computer has a physical parallel port. You can work around the issue:

. Use Device Management and disable the physical port if the actual printer is a network printer remote from you;

. or, Use Devcon.exe in your logon script to effect automaticly the same change:
____________________________
Users Helping Users
 
None of the above options has helped much.

However, checking the Hardware Timer Emulation ON in Advanced options for the application shortcut may have done the trick.

I have changed a few other things on and off, but by some odd way it suddenly seems to work.

Unfortunately, these "Now It Works"/"Now it Don't" things don't teach anybody anything :-(
 
An update :-(

The system seems to work better now, but still, ocationally, it fails to print.

At times only the DOS application needs to be restarted. Other times requre a total restart of Windows.

It happens so seldom, however, that my dad is unable to say, exactly under which conditions and with what prehistory it happens. (Also too complicatet, I guess. He is pushing on 80!)

But again:
Why does it work on an off like that?
The DOS app. sends esc sequences for pitch formatting as was the way of doing things in the old days. Could some of these, given some special printing prehistory foul up the printer driver/spooler?
 
A final update :)

The resources for the DOS application had to be lowered, which freed time for the print spooler to run!
The DOS plug-in in XP pulled 100% I found out. Now it only uses up 50%.

After that the application has now been working for weeks without any glitches.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top