根据在网上查询的资料 ,我用了如下代码,什么名称,打印作业数等都能知道,但
是状态值,始终为0,不知为何。
procedure TForm1.Button1Click(Sender: TObject);
var
prnhandle:thandle;
info
ointer;
n
WORD;
s1,s2,s3:array[0..1024]of char;
hmem
WORD;
begin
if openprinter('Epson LQ-300K',prnhandle,nil) then
showmessage('Epson LQ-300K');
GetPrinter(prnhandle,2,@info,0,@n);
if( GetLastError()=122 )then
GetMem(info,n);
GetPrinter(prnhandle,2,info,n,@n) ;
if PRINTER_INFO_2(info^).Status=PRINTER_STATUS_OFFLINE then
ShowMessage('ok');
closeprinter(prnhandle);
end;