• <th id="ltxwt"></th>

      delphi中如何判斷打印機是否安裝

      2016-08-01
      uses Printers;
          
           procedure TForm1.Button1Click(Sender: TObject);
           begin
           if Printer.Printers.Count <= 0 then
           { 沒有安裝 };
           end;
          
           Top
           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

      天堂网