您现在的位置:首页 >> 硬件系统 >> 硬件系统 >> 内容

Delphi中检测打印机状态

时间:2011/9/3 15:19:05 点击:

  核心提示:function TestPrinterStatus(LPTPort: Word): Byte; var Status: byte; CheckLPT: word; begin Status := 0...
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) 
  Note: 
  This 
function doesn't work under NT, it gives an access violation 
  from the DOS interrupt call. 
} 

作者:网络 来源:转载
共有评论 0相关评论
发表我的评论
  • 大名:
  • 内容:
  • 盒子文章(www.2ccc.com) © 2022 版权所有 All Rights Reserved.
  • 沪ICP备05001939号