//取得当前打印机的信息;我系统在2000下。
var
PrtInfo2:_PRINTER_INFO_2A;
R:DWord;
H:THandle;
begin
FillChar(PrtInfo2,SizeOf(PrtInfo2),0);
if not GetPrinter(Printer.Handle,2,@PrtInfo2,SizeOf(PrtInfo2),@r) then
ShowMessage('Error');
end;GetPrinter返回结果总是False.请高手赐教!
var
PrtInfo2:_PRINTER_INFO_2A;
R:DWord;
H:THandle;
begin
FillChar(PrtInfo2,SizeOf(PrtInfo2),0);
if not GetPrinter(Printer.Handle,2,@PrtInfo2,SizeOf(PrtInfo2),@r) then
ShowMessage('Error');
end;GetPrinter返回结果总是False.请高手赐教!
pinfo: pPRINTERINFO2;
pprt,a: Cardinal;
b:PDWORD;
begin
b:=allocmem(256);
pinfo:=AllocMem(1000);
if OpenPrinter('HP DJ 200',pprt,nil) then
begin
a:=1000;
if getprinter(pprt,2,pinfo,a,b) then
showmessage(pinfo.pPrinterName+' ststus:'+inttostr(pinfo.Status));
ClosePrinter(pprt);
end;
我试了一下,发现在GetPrinter的地方还是出错!我是引用WinSpool.pas文件的,不知道您是用什么方法声明的?