GetPrinter在Winme 下的打印机状态总是返回0呢?谁能用api的到打印机的状态,送 500分 (100分)

  • 主题发起人 plane822
  • 开始时间
这么说打印机的状态在winme上是检测不到了
 
Printer_Status are the various possible states a printer can be in. Note that this information is provided by the printer driver and in many cases the status will always be "Ready" unless there is one or more jobs in error on that printer.
(http://www.merrioncomputing.com/EventVB/EventVB~ApiPrinter~Printer_Status_EN.html)
以上是从网站上抄下的,意思是不是跟打印机的驱动有关呢
 
我看到有个比较有意思的消息: WM_SPOOLERSTATUS
你先看看下面这个有没有效果?我没有打印机。
procedure WM_SpoolerStatus(var Msg: TWMSPOOLERSTATUS);
message WM_SPOOLERSTATUS;
procedure TForm1.WM_SpoolerStatus(var Msg: TWMSPOOLERSTATUS);
begin
Caption := '当前打印机队列中有' + IntToStr(msg.JobsLeft) + '项任务。';
Msg.Result := 0;
end;

 
WM_SPOOLERSTATUS消息即使没有连接打印机也能正常发送和接受
但是其状态还是不能返回正确值,另外我的打印机驱动有厂家提供的
也有从网上下的,为什么都不行。。。。。。。。
 
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 &amp;Status, ah;
end;

end;

Result := Status;
end;

//返回的错误:自己转换就可以了
01h - Timeout
08h - I/O Error
10h - Printer selected
20h - Out of paper
40h - Printer acknowledgement
80h - Printer not busy (0 if busy)
==========================================

int 17h;处出错,不解~~~~~~~~~~~~~~~~
 
int 17h只能win98下使用,在2000下就肯定报错了
 
顶部