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!

need DOS print queue for XP

Status
Not open for further replies.

CodeSculptor

Programmer
Jun 21, 2006
5
US
We have an old DOS-based print queuing program that we need to port to Windows. The conversion is necessary because we have a very large DOS based business application that must work under Windows 2000 or XP. The business application prints directly to LPT1, LPT2, or LPT3, and unfortunately we cannot convert it to use windows printing because it is too large to rewrite and incorporates too many 16 bit libraries to convert. By itself, the business application works except it prints directly to printers mapped to LPT1/2/3 since the queuing program we use is not W2K compliant. The queuing program would normally capture the data bound for these printer ports so that we can print them from other locations, write them to files, put online, etc.
The problem is that we don’t know how to intercept files bound for the standard printer ports. For example, if we were to type:
echo Hello > lpt1
at a command prompt in Windows 2000, we’d want the new queuing application to intercept this stream so that we print the statement on any HP printer we want later (our business application only uses HP PCL when printing to a printer port). Same thing if we do an fprintf to the printer port from the business application.
Is there an easy way to do this?
 
How is the network printer set up? On a Windows server? On a NetWare server? Direct IP connection?
 
Hi, CodeSculptor

What I do in my apps is put the print output into a text file and then shell out to CMD with a command line of "WORDPAD.EXE <textfilename>" which starts Wordpad in a separate window so the user can see the report on screen and then print it wherever they want (as well as save a copy and/or reformat). When they close Wordpad control returns to the DOS app.

If that is not appropriate to your app, you could take a look at:
which provides a lot of flexibility and enables you to control losing focus from the DOS window, which is nice if you are running full-screen.

Jock
 
The key is that we have to redirect data from our DOS program (which can't be modified) that normally would print to a printer port. We are not trying to print to an actual windows printer, we are trying to capture the raw data stream and process that in various ways with our to-be-developed application.
 
according to the PrintFil site:
"...you can have Printfil capturing a parallel port output, automatically redirecting your print jobs to any printer, even to a printer which is physically connected to the captured port.
"

now if we could figure out how PrinFil captures the parallel port output, then we'd most likely have what we need... Actually the old "PrintQ" app did what we need (separate each DOS print job out into a separate queue for each user, which could then be printed -- or not -- from the PrintQ app) Unfortunately, it doesn't run on 2000 or above, and the new version doesn't have the same functionality.
 
If the printer is on a server can you use the net use command to any good effect.

i.e.

net use LPT3: \\server\my-printer

That certainly captures all DOS output to LPT3 and redirects it to the network printer. So that you can then do a copy con lpt1 command in a dos box.
 
Meant to say - and DOS available port can be used - COM1 - LPT1 etc etc...
 
what we are trying to do now is to access/manipulate
the two spool files generated by Win 2K for each print job.
(the .SHD file for job settings, and the .SPL job for the drawing commands).Looks like you can use the Win32 API "EnumJobs" to fill an array of JOB_INFO_2 structures, one for each print job in the spooler folder; But the info in JOB_INFO_2 doesn't seem to indicate which set of .SPL,.SHD files it corresponds to (one set for each
print job). We would like to be able copy the .SPL files to another folder, categorize them based on the user and what kind of job the user was printing, and print the entire set of jobs at once to a particular printer...all of this the old PrintQ software was able to do (Win98), but
how to duplicate this functionality in Win2K and beyond, I don't know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top