home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mega CD-ROM 1
/
megacd_rom_1.zip
/
megacd_rom_1
/
MAGAZINE
/
INSIDE_T
/
ITPFEB90.ZIP
/
CHKPRNTR.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1990-02-06
|
1KB
|
66 lines
PROGRAM ChkPrinter;
USES Dos,Crt;
VAR
Lprn: Integer;
St : STRING;
FUNCTION PrinterOk(Lprn : Integer) : Boolean;
VAR Ok : Boolean;
Regs : Registers;
St : STRING;
Code : Byte;
BEGIN {PrinterOk}
Ok := FALSE; PrinterOk := FALSE;
Dec(Lprn);
IF ((Lprn >= 0) AND (Lprn <= 2)) THEN
REPEAT
Regs.ah := 2;
Regs.dx := Lprn;
Intr($17, Regs);
Code := Regs.ah;
IF Code <> $90
THEN
BEGIN
CASE Code OF
$02, $4A : St:= ' Printer is not connected ';
$00, $10, $08,
$18, $58 : St:= ' Printer is offline ';
$28, $38 : St:= ' Printer is out of paper ';
$88, $C8 : St:= ' Printer is turned off ';
ELSE St:= 'Output device is not ready';
END; {CASE}
GotoXY(1,1);
WriteLn(St,' Code #: ',Code);
WriteLn(' ');
WriteLn('Please correct the error');
WriteLn('or press a key to continue')
END
ELSE
Ok := TRUE;
UNTIL Ok OR KeyPressed;
IF Ok THEN PrinterOk := Ok
END; {PrinterOk}
{********************}
BEGIN
ClrScr;
IF ParamCount <> 0
THEN BEGIN
St := Copy(ParamStr(1), 1, 1);
Lprn := Ord(St[1]) - 48
END
ELSE Lprn := 1;
IF PrinterOk(Lprn) THEN
WriteLn('Printer Ok')
ELSE
WriteLn('Printer not Ok')
END.