Title: Get number of printer's jobs
Windows uses WM_SPOOLERSTATUS, when we add or remove printer's jobs. So, we will hook this message.
Implementation of this idea is so:
type
TForm1 = class(TForm)
Label1: TLabel;
private
procedure WM_SpoolerStatus(var Msg: TWMSPOOLERSTATUS);
message WM_SPOOLERSTATUS;
public
end;
...
procedure TForm1.WM_SpoolerStatus(var Msg: TWMSpoolerStatus);
begin
Label1.Caption:=IntToStr(Msg.JobsLeft);
end;