印表機的總頁數無法取得 |
缺席
|
yclin
一般會員 ![]() ![]() 發表:2 回覆:4 積分:1 註冊:2004-05-10 發送簡訊給我 |
各位大大好:
以下是小弟所擷取的程式碼: var pi2:PRINTER_INFO_2; hPrinter:THandle; Jobs: array[0..1000] of TJobInfo2; BytesNeeded, NumJobs: Dword; begin pi2.pPrinterName := 'SHARP AR-266FP SPDL2_T1'; // OpenPrinter(pi2.pPrinterName ,hPrinter,0); if OpenPrinter(pi2.pPrinterName ,hPrinter,0) then begin while true do begin WaitForPrinterChange(hPrinter, PRINTER_CHANGE_ADD_JOB); if EnumJobs(hPrinter, 0, 1000, 2, @Jobs, SizeOf(Jobs), BytesNeeded, NumJobs) then begin if NumJobs <> 0 then begin with Jobs[NumJobs-1] do showmessage(StrPas(pUserName) StrPas(pMachineName) StrPas(pDocument) Format('d',[TotalPages])); end; end; end; end; end; 為何TotalPages所抓取的資料皆為零? 謝謝各位解答! 編輯記錄
yclin 重新編輯於 2011-03-23 21:02:36, 註解 無‧
|
P.D.
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:603 回覆:4038 積分:3874 註冊:2006-10-31 發送簡訊給我 |
雖然不是很能看懂這段程式, 不過就所發上來的程式段看不到 totpage 在那裡有計算值?
===================引 用 yclin 文 章=================== 各位大大好: 以下是小弟所擷取的程式碼: var ??? pi2:PRINTER_INFO_2; ??? hPrinter:THandle; ??? Jobs:?? array[0..1000]?? of?? TJobInfo2; ??? BytesNeeded,?? NumJobs:?? Dword; begin ? pi2.pPrinterName?? := 'SHARP AR-266FP SPDL2_T1'; ? // OpenPrinter(pi2.pPrinterName?? ,hPrinter,0); ? if?? OpenPrinter(pi2.pPrinterName?? ,hPrinter,0)?? then ??? begin ??? while?? true?? do ??? begin ??? WaitForPrinterChange(hPrinter,?? PRINTER_CHANGE_ADD_JOB); ??? if?? EnumJobs(hPrinter,?? 0,?? 1000,?? 2,?? @Jobs,?? SizeOf(Jobs), ??? BytesNeeded,?? NumJobs)?? then ??? begin ??? if?? NumJobs?? <>?? 0?? then ??? begin ??? with?? Jobs[NumJobs-1]?? do ? showmessage(StrPas(pUserName) StrPas(pMachineName) StrPas(pDocument) Format('d',[TotalPages])); ??? end; ??? end; ??? end; ??? end; end; 為何TotalPages所抓取的資料皆為零? 謝謝各位解答! |
yclin
一般會員 ![]() ![]() 發表:2 回覆:4 積分:1 註冊:2004-05-10 發送簡訊給我 |
===================引 用 P.D. 文 章=================== 雖然不是很能看懂這段程式, 不過就所發上來的程式段看不到 totpage 在那裡有計算值? ===================引 用 yclin 文 章=================== 各位大大好: 以下是小弟所擷取的程式碼: var ??? pi2:PRINTER_INFO_2; ??? hPrinter:THandle; ??? Jobs:?? array[0..1000]?? of?? TJobInfo2; ??? BytesNeeded,?? NumJobs:?? Dword; begin ? pi2.pPrinterName?? := 'SHARP AR-266FP SPDL2_T1'; ? // OpenPrinter(pi2.pPrinterName?? ,hPrinter,0); ? if?? OpenPrinter(pi2.pPrinterName?? ,hPrinter,0)?? then ??? begin ??? while?? true?? do ??? begin ??? WaitForPrinterChange(hPrinter,?? PRINTER_CHANGE_ADD_JOB); ??? if?? EnumJobs(hPrinter,?? 0,?? 1000,?? 2,?? @Jobs,?? SizeOf(Jobs), ??? BytesNeeded,?? NumJobs)?? then ??? begin ??? if?? NumJobs?? <>?? 0?? then ??? begin ??? with?? Jobs[NumJobs-1]?? do ? showmessage(StrPas(pUserName) StrPas(pMachineName) StrPas(pDocument) Format('d',[TotalPages])); ??? end; ??? end; ??? end; ??? end; end; 為何TotalPages所抓取的資料皆為零? 謝謝各位解答! 這個方法已經放棄,改用其他方式處理了.......... 謝謝各位! |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |