Z
zhangwq
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.Button1Click(Sender: TObject);
var
pinfo:^PRINTER_INFO_2;
pprt,a: Cardinal;
bDWORD;
begin
b:=AllocMem(256);
pinfo:=AllocMem(1000);
if OpenPrinter('myPrinter',pprt,nil) then
begin
a:=1000;
if getprinter(pprt,2,pinfo,a,b) then
showmessage(pinfo.pPrinterName+' ststus:'+inttostr(pinfo.status));
ClosePrinter(pprt);
end;
freemem(b);
freemem(pinfo);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;
不论打印机是否联机,返回的状态都不变。为什么这个API不起作用?
var
pinfo:^PRINTER_INFO_2;
pprt,a: Cardinal;
bDWORD;
begin
b:=AllocMem(256);
pinfo:=AllocMem(1000);
if OpenPrinter('myPrinter',pprt,nil) then
begin
a:=1000;
if getprinter(pprt,2,pinfo,a,b) then
showmessage(pinfo.pPrinterName+' ststus:'+inttostr(pinfo.status));
ClosePrinter(pprt);
end;
freemem(b);
freemem(pinfo);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;
不论打印机是否联机,返回的状态都不变。为什么这个API不起作用?