捕获打印消息后,能否等到打印的相关信息,如打印的文件名,打印的时间等等

解决方案 »

  1.   

    可以,
    它的最后一个参数就是 *ppprinternotifyinfo
      

  2.   

    procedure TForm1.Button1Click(Sender: TObject);Var
       PrinterName:Pchar;
       PrinterHandle : THandle;
       chgObject:THandle;
       pdwChange:DWORD;
       pno:PRINTER_NOTIFY_OPTIONS;
       pPrnNotifyInfo:pPrinterNotifyInfo;
       fcnReturn:LongBool;
       Jobs: array[0..1000] of TJobInfo2;
    begin
         pdwChange:=0;
         FillChar(pno, SizeOf(pno), 0);
         FillChar(pPrnNotifyInfo, SizeOf(pPrnNotifyInfo), 0);
         PrinterName:='HP LaserJet 4';
         if OpenPrinter(PrinterName,PrinterHandle,nil) then
         begin
              chgObject:=FindFirstPrinterChangeNotification(PrinterHandle,PRINTER_CHANGE_ALL, 0,@pno);
              WaitForSingleObject(chgObject,INFINITE);
              fcnReturn :=FindNextPrinterChangeNotification(chgObject,pdwChange,@pno,Pointer(pPrnNotifyInfo));
              if ord(fcnReturn)<>0 then
              begin
              showmessage('打印信息');
              end;
         end;
    end;
    可是我在pPrnNotifyInfo里得到是0啊!!
      

  3.   

    哪位大哥来解释下啊 ,难道还的用EnumJobs()来做吗?