This is a rather 'How different is Windows from DOS' type of question.
- On DOS you always should handle any printer 'out of order' situation. If you didn't an application would halt until the situation is taken care of.
- On Windows, printers are fed by a 'spooler' system, Windows catches any app's output, puts it in a queue, and stuffs it into the printer, if an when it's ready for it.
No _need_ for an app to check if the printer is ready.
OTOH, if you need to be sure that some information is actualy printed and has come out of that printer, before the app can continue, as is most usual the case when this question pops up, then you need to get access to the printer info in some way. Time to get your hands dirty on Windows compatible (32 bit) programmin'!
The easies way to be able to get this info is to recompile your code with (x)Harbour, available from either
(open source). (x)Harbour is a Clipper 5.2/5.3 compatible compiler that's available for several platforms, like Windows, Unix, Linux, Mac OS-X and OS/2.
Go to any of the before mentioned websites and get the info/stuff you need. xharbour.com is the easiest to get started, xharbour.org is the cheapest way to get things rolling, and is also very well supported with a very active community on the news server nntp://news.xharbour.org
Even in xp, you can check for printer, but only if it is local printer, connected with parallel cable to computer. If you are using s87, there are some helpful functions:
- Printready, Printstat and Isbit
I use following code:
FUNCTION Prt_Chk
IMEPRO='PRT_CHK' && not relevant
if type("dosprt")="U" && not relevant
dosprt=1
endif
NAPREJ=.F.
IF .NOT. Printready(dosprt) && Printer is not ready
status = Printstat(dosprt) && Get status
DO CASE
CASE Isbit(status,1) && 1st bit on ?
@8,41 SAY "NOT busy ... "
CASE Isbit(status,2) && 2nd bit on ?
@8,41 SAY "Acknowledged ... "
CASE Isbit(status,3) && 3rd bit on ?
@8,41 SAY "End of paper error "
CASE Isbit(status,4) && 4th bit on ?
@8,41 SAY "On line, NOT ready "
CASE Isbit(status,5) && 5th bit on ?
@8,41 SAY "Powered off ... "
CASE Isbit(status,8) && 8h bit on ?
@8,41 SAY "Time out error ... "
ENDCASE
ELSE
NAPREJ=.T.
@8,41 SAY "On line & busy ... "
ENDIF
INKEY(.2)
IF LASTKEY()=27
NAPREJ=.T.
ENDIF
RETURN NAPREJ
&& end of code
All three functions are part of NT1.LIB - nantucket tools for s87 clipper.
If you are printing to a network printer like:
net use lpt2: \\servername\printername
then it is impossible to check out the status of pins of parallel port and it is not necessary either, because all printout will go to spooler of the computer that is serving the printer and when printer become online, it will print all jobs.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.