uses Printers;procedure TForm1.Button1Click(Sender: TObject); begin if Printer.Printers.Count <= 0 then { 没有安装 }; end;
function GetPrinterStatus:byte;asmMOV DX,$379;IN AL,DX;end;//获取打印机是否出错function CheckPrinter:boolean;vartemp:byte;begintemp:=GetPrinterStatus;Result:=not ( ((temp and $80)=0) //打印机忙or ((temp and $20)<>0) //打印机缺纸or ((temp and $10)=0) //打印机未联机or ((temp and $08)=0) ); //打印机出错;end;
begin
if Printer.Printers.Count <= 0 then
{ 没有安装 };
end;