Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Printers Print Only On Exit in FPD2.6 App
Message
From
17/06/2001 16:27:55
 
 
To
16/06/2001 23:19:46
Larry Long
ProgRes (Programming Resources)
Georgia, United States
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00520213
Message ID:
00520402
Views:
15
>Al,
>In order to make a DOS program print immediately, you have to force Windows to "see" the print job. The way you do this is to issue a command that creates an interrupt. I did this by issuing a !REM>NUL command right after the REPORT FORM... statement.

That's not strictly true. Windows "sees" the print job just fine - the issue is telling Windows that the job has completed, so it can despool it to the printer or remote queue. DOS programs typically don't explicitly tell the spooler the job is finished because in most cases they don't know that their jobs are being spooled. For those few that *are* spooler-aware, under DOS they must provide different despool commands for Windows vs. Novell, etc. which is a PITA.

Modern print spoolers/redirectors get around this by offering a default timeout period - if a job is started, and a period of time passes with no further print output, then the job is *assumed* to have completed and is despooled automatically. With today's fast computers the timeout value can usually be set as low as 5 seconds as long as there aren't any huge computational delays while generating the report.

I'm intrigued by your !REM>NUL approach. Have you tested this on various OSs, including NT/W2K? All that you're doing is firing a REMARK to the NUL device, not to a print (LPTx, LPTx.DOS) device or spooler/queue, so really all you're doing is pinging the redirector. I can't figure out why this should work (although I'm not disputing it does for you).


>>>I'm just starting to look at some legacy code for a client and one of the problems their having is that the printer will only print when the app is shut down. They choose to print, nothing happens, then the printer kicks in as soon as they exit. The developer before me told them that that's just what they would need to do to print any reports...like it was a feature. Man, I Love those kind of developers! :) Anyway, it doesn't really sound like a Foxpro printer issue to me, per se, but could there be something on exit that forces a buffer or something to clear? The client said it used to work at one time. I won't have the code for a couple days, but I wanted to at least get some ideas in the meantime. Thanks!
>>
>>If it's NT/W2K look at LPT_Timeout in http://support.microsoft.com/support/kb/articles/Q102/0/59.asp
>>
>>If Win9x, look at http://support.microsoft.com/support/kb/articles/Q140/0/36.asp
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Reply
Map
View

Click here to load this message in the networking platform