Remmie26
asked on
find out when a job have finished printing
Hi, I have a list of document in a loop to be sent to the a selected printer, How do I pause the loop execution until the prior document has completed the printing process.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
var
AHandle: THandle;
NumJobs, DataSize: Cardinal;
begin
Result := 0;
if PrinterName <> '' then
try
if OpenPrinter(PChar(PrinterN
try
EnumJobs(AHandle, 0, 5000, 2, nil, 0, DataSize, NumJobs);
if (NumJobs = 0) and (DataSize <> 0) then
NumJobs := DataSize div 1048
finally
ClosePrinter(AHandle);
end;
Result := NumJobs;
except
// Catch errors
end;
end;