Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Tom Rettigs Library - prnstatus() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 PRNSTATUS()
 Evaluates the printer status.
 Returns <expN> parallel printer status code.

 Code   Meaning
 ----   -------------------------------------
    0   Printer OK
    1   Printer connected and off-line
    2   Printer connected and turned off
    3   Printer not connected or out of paper
   -1   Can't tell

 Checks output device address associated with LPT1.

 @...SAY "Ready the printer, and press any key to begin..."
 DO WHILE PRNSTATUS() # 0
    prn_status = PRNSTATUS()
    @...SAY "The printer is "
    DO CASE
       CASE prn_status = 1
          @...SAY "OFF LINE."
       CASE prn_status = 2
          @...SAY "TURNED OFF."
       CASE prn_status = 3
          @...SAY "NOT CONNECTED OR OUT OF PAPER."
       CASE prn_status = -1
          @...SAY "NOT WORKING OR BEHAVING STRANGELY."
    ENDCASE
    @...SAY "Ready the printer or press Escape to cancel"
    x = INKEY(5000)
    IF x = 27 .OR. x = 0   && Esc or if time runs out
       RETURN
    ENDIF
 ENDDO
 @...    && clear the above prompts
 @...SAY "Printing, please do not disturb"
 <output to printer>

 Hazard
    Checks only parallel printers.  Serial printers using
    redirected output with the DOS MODE command are not checked.

    Wherever possible, library routines use DOS function calls
    (int 21h) for maximum portability between various computers.
    But, for the library to perform an operation where that
    facility is not available from DOS, we had to use a direct ROM
    BIOS interrupt.  These may not work properly (or at all) on
    some computers.  Test these functions on the target hardware
    before relying on their use in your application.


             Placed in the Public Domain by Tom Rettig Assoc.

See Also: ISPRINTER() LPTSWAP

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson