home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
insidetp
/
1990_01
/
printchk.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-12-15
|
859b
|
49 lines
PROGRAM PrintChk;
USES Crt,Dos,Printer;
CONST
LPT1 = 0;
LPT2 = 1;
LPT3 = 2;
PrnReady = $90;
Offline = $00;
PaperOut = $20;
NoConnect = $C0;
FUNCTION ChkPrinter(Printer : Word) : Word;
VAR Regs:Registers;
BEGIN
Regs.AH:=2;
Regs.DX:=Printer;
Intr($17,Regs);
ChkPrinter:=Regs.AH
END;
PROCEDURE PrinterError(ErrorCode : Word);
BEGIN
CASE ErrorCode OF
NoConnect: WriteLn('Printer not connected');
Offline : WriteLn('Printer off line');
PaperOut : WriteLn('Printer out of paper');
ELSE
WriteLn('Printer error code: ',ErrorCode);
END
END;
PROCEDURE TryPrinter;
BEGIN
{$I-}
WriteLn(Lst,'Check Printer'+#12);
{$I+}
WriteLn(IOResult)
END;
BEGIN
ClrScr;
{TryPrinter;}
IF ChkPrinter(LPT1)=PrnReady THEN
WriteLn('Printer is Ready')
ELSE
PrinterError(ChkPrinter(LPT1))
END.