我是新手,在delphi中怎么判斷并口無驅列印機是否連接。
這是代碼。
function GetPrinterStatus:byte;
asm
MOV DX,$379;
IN AL,DX;
end;
//獲取列印機是否出錯
function CheckPrinter:boolean;
var temp:byte;
begin
temp:=GetPrinterStatus;
Result:=not ( ((temp and $80)=0) //列印機忙
or ((temp and $20)<>0) //列印機缺紙
or ((temp and $10)=0) //列印機未聯機
or ((temp and $08)=0) ); //列印機出錯;
end;
運行時提示privileged instruction。
好像 windowsXP系統不能對I/O直接操作。
求助各位大俠,還有別的什么方法么?
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/130125.html
標籤:語言基礎/算法/系統設計
