K
king.gray
Unregistered / Unconfirmed
GUEST, unregistred user!
以下程序取到的页数TotalPages始终为0,为什么?<br>function TGetJobsNT.GetJob: string;<br>const<br> InfoLevel = 1;<br> FirstJob = 0;<br> LastJob = 19;<br>var<br> Jobs: array[FirstJob..LastJob] of TJobInfo1;<br> BytesNeeded, NumJobs: Dword;<br> hPrinter: THandle;<br> JobsRecord: string;<br>begin<br> JobsRecord := '';<br> if OpenPrinter(Pchar(FPrinterName), hPrinter, nil) then<br> begin<br> WaitForPrinterChange(hPrinter, PRINTER_CHANGE_ADD_JOB);<br> if EnumJobs(hPrinter, FirstJob, LastJob + 1, InfoLevel, @Jobs, SizeOf(Jobs),<br> BytesNeeded, NumJobs) then<br> begin<br> if NumJobs <> 0 then<br> begin<br> with Jobs[NumJobs - 1] do<br> begin<br> JobsRecord := JobsRecord + StrPas(pDocument) + #9;<br> JobsRecord := JobsRecord + StrPas(pPrinterName) + #9;<br> JobsRecord := JobsRecord + StrPas(pMachineName) + #9;<br> JobsRecord := JobsRecord + StrPas(pUserName) + #9;<br> JobsRecord := JobsRecord + IntToStr(TotalPages) + #9;<br> JobsRecord := JobsRecord +<br> DateTimeToStr(SystemTimeToDateTime(Submitted) + 8 / 24) + #9;<br> end;<br> end;<br> end;<br> ClosePrinter(hPrinter);<br> end;<br> Result := JobsRecord;<br>end;