//取得当前打印机的信息;我系统在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.请高手赐教!

解决方案 »

  1.   

    var
      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;
      

  2.   

    to  WWWWA(aaaa):
      我试了一下,发现在GetPrinter的地方还是出错!我是引用WinSpool.pas文件的,不知道您是用什么方法声明的?
      

  3.   

    还没有人回答? WWWWA(aaaa)的回答在Win98下可用,但是我接下去的SetPrinter提出正常,但是在打印机默认设置中没有变化。不知道怎么回事