我现在想获得打印机的状态,在微软网站找到一篇文章 ,在网上也查了很多资料,但GetPrinter一直就没成功过?????
if (!GetPrinter(hPrinter, 2, NULL, 0, &cByteNeeded))
{
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)  总是跳进来!
return FALSE;
}

解决方案 »

  1.   

    这样写:
    var
       Device:  array[0..255]  of  char;
       Driver:  array[0..255]  of  char;
       Port:  array[0..255]  of  char;
       hDMode:  THandle;
    begin
       Printer.PrinterIndex  :=  Printer.PrinterIndex;
       Printer.GetPrinter(Device,  Driver,  Port,  hDMode);  
       if  hDMode  <>  0  then
      

  2.   

    想监视打印机的状态,类似于系统自带的'打印机和传真',如果没纸,上面会显示缺纸了,等等,看了N多方法,如使用GetPrinter等等,都不行~!!!!!!!  
     
    http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q160/1/29.asp&NoWebContent=1
      

  3.   

    //补充一下二楼
    //加一个判断if hDMode = 0 then
    begin
      Printer.PrinterIndex := Printer.PrinterIndex;
      Printer.GetPrinter(Device,  Driver,  Port,  hDMode);  
    end;if  hDMode  <>  0  then
     ...