home *** CD-ROM | disk | FTP | other *** search
-
-
- Print-Protect
-
- This is a very easy to use Turbo Pascal 4.0 unit which will allow any
- Pascal program to access a printer in a "user-friendly" manner (to use
- that horribly cliched and currently out-of-favor term).
-
- Quite simply, a program need only include the unit PRNTPROT via a USES
- clause instead of the Turbo Pascal unit PRINTER. The unit will
- automatically open the LST device and assign it to LPT1. If another
- printer is to be accessed, simply call the procedure AssignPrt
- as follows:
-
- AssignPrt(tfile,printer_name);
-
- where TFILE is declared as being of type TEXT, and PRINTER_NAME is
- one of LPT1, LPT2, LPT3, or LPT4. Thus the statement below would
- open a file called "Lister" to operate on LPT2.
-
- Var Lister:Text;
- :
- AssignPrt(Lister,LPT2);
-
- When a printer error occurs, the user is normally asked to correct the
- situation and then press <Enter> to continue. The program will proceed
- as if nothing had happened.
-
- The user is generally also given the choice of pressing <Esc> to
- "de-activate" the printer. In this case, no more characters will be sent
- to the printer, but the program will proceed as if the printer was
- working. This is useful if the problem with the printer cannot be
- resolved; rather than have the program simply "Abort" as per MS-Dos, the
- user will be able to continue working (and save his files that might
- otherwise have been lost, etc).
-
- If desired, the program can check periodically to see if the printer
- associated with any given file is deactivated by using the function
- "IsDeactivated," and then, if appropriate, the program can then
- "re-activate" that printer with the procedure "Reactivate":
-
- if IsDeactivated(Lister) then ...
- <ask user if printer has been fixed>
- if so then
- Reactivate(Lister);
-
-
- The file PRNTSAMP is a sample program which uses this unit.