home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / PRNTPROT.ZIP / PRNTPROT.DOC next >
Encoding:
Text File  |  1988-01-28  |  2.0 KB  |  48 lines

  1.  
  2.  
  3.                     Print-Protect
  4.  
  5.    This is a very easy to use Turbo Pascal 4.0 unit which will allow any
  6.    Pascal program to access a printer in a "user-friendly" manner (to use
  7.    that horribly cliched and currently out-of-favor term).
  8.  
  9.    Quite simply, a program need only include the unit PRNTPROT via a USES
  10.    clause instead of the Turbo Pascal unit PRINTER.  The unit will
  11.    automatically open the LST device and assign it to LPT1.  If another
  12.    printer is to be accessed, simply call the procedure AssignPrt
  13.    as follows:
  14.  
  15.          AssignPrt(tfile,printer_name);
  16.  
  17.    where TFILE is declared as being of type TEXT, and PRINTER_NAME is
  18.    one of LPT1, LPT2, LPT3, or LPT4.  Thus the statement below would
  19.    open a file called "Lister" to operate on LPT2.
  20.  
  21.          Var Lister:Text;
  22.          :
  23.          AssignPrt(Lister,LPT2);
  24.  
  25.    When a printer error occurs, the user is normally asked to correct the
  26.    situation and then press <Enter> to continue.  The program will proceed
  27.    as if nothing had happened.
  28.  
  29.    The user is generally also given the choice of pressing <Esc> to
  30.    "de-activate" the printer.  In this case, no more characters will be sent
  31.    to the printer, but the program will proceed as if the printer was
  32.    working.  This is useful if the problem with the printer cannot be
  33.    resolved; rather than have the program simply "Abort" as per MS-Dos, the
  34.    user will be able to continue working (and save his files that might
  35.    otherwise have been lost, etc).
  36.  
  37.    If desired, the program can check periodically to see if the printer
  38.    associated with any given file is deactivated by using the function
  39.    "IsDeactivated," and then, if appropriate, the program can then
  40.    "re-activate" that printer with the procedure "Reactivate":
  41.  
  42.           if IsDeactivated(Lister) then ...
  43.              <ask user if printer has been fixed>
  44.              if so then
  45.                 Reactivate(Lister);
  46.  
  47.  
  48.    The file PRNTSAMP is a sample program which uses this unit.