以下函数可检测打印机的状态: function TestPrinterStatus(LPTPort: word): byte; var Status: byte; CheckLPT: word; begin Status := 0; if (LPTPort >= 1) and (LPTPort <= 3) then begin CheckLPT := LPTPort -1; asm mov dx, CheckLPT; mov al, 0; mov ah, 2; int 17h; mov &Status, ah; end; end; Result := Status; end; Pass in the LPT port number you want to check & get the following back: 01h - Timeout 08h - I/O Error 10h - Printer selected 20h - Out of paper 40h - Printer acknowledgement 80h - Printer not busy (0 if busy)
function TestPrinterStatus(LPTPort: word): byte;
var
Status: byte;
CheckLPT: word;
begin
Status := 0;
if (LPTPort >= 1) and (LPTPort <= 3) then
begin
CheckLPT := LPTPort -1;
asm
mov dx, CheckLPT;
mov al, 0;
mov ah, 2;
int 17h;
mov &Status, ah;
end;
end;
Result := Status;
end; Pass in the LPT port number you want to check & get the following back:
01h - Timeout
08h - I/O Error
10h - Printer selected
20h - Out of paper
40h - Printer acknowledgement
80h - Printer not busy (0 if busy)