M_AR
asked on
print spooler job access!
I'm actually looking for a way to intercept a document send in the spooler via delphi's code.
The large part of my problem is that some printers don't save print job to the hard drive. There's an API call (FindFirstPrinterChangeNot ification [winspool]) that i can use. But i've tried it and it seems that it's looking in the spool directory if there's a new job added to the spooler. Like i've said, some printer don't save a file to the hard drive, i need a way to capture all the data of the print jobs not saved to the drive.
Do anybody know how to get the information directly from the spooler?
Thank you!
The large part of my problem is that some printers don't save print job to the hard drive. There's an API call (FindFirstPrinterChangeNot
Do anybody know how to get the information directly from the spooler?
Thank you!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In your main forms declaration, after the private keyword, add
Procedure WMSpoolerstatus( Var msg: TWMSpoolerStatus );
message WM_SPOOLERSTATUS;
This declares a message handler. You implement it like this in the units
Implementation section:
Procedure TFormX.WMSpoolerstatus( Var msg: TWMSpoolerStatus );
Begin
label1.caption:= Format('Spooler status code: %d',
[ msg.JobStatus ]);
label2.caption:= Format('Jobs left: %d', [msg.JobsLeft]);
End;
You need the Messages unit in your uses clause (should already be
there), this unit is also where you can look up the definition of the
TWMSpoolerStatus record.
Procedure WMSpoolerstatus( Var msg: TWMSpoolerStatus );
message WM_SPOOLERSTATUS;
This declares a message handler. You implement it like this in the units
Implementation section:
Procedure TFormX.WMSpoolerstatus( Var msg: TWMSpoolerStatus );
Begin
label1.caption:= Format('Spooler status code: %d',
[ msg.JobStatus ]);
label2.caption:= Format('Jobs left: %d', [msg.JobsLeft]);
End;
You need the Messages unit in your uses clause (should already be
there), this unit is also where you can look up the definition of the
TWMSpoolerStatus record.
Hello?
ASKER
Thanx Epsylon for the code provided. Actually it didn't fix my problem. I've found a way to do it and it work. So no more problem! I'll give you the points anyway because the comment you gave me helped me to solve another of my problem. Accessing the data structure of the printer and the print job!
Thanks :o)
MAR how did you find the solution? and if this comment didn't why did you accept it? can you email me the solution?
Regards,
ates@anet.net.tr
Regards,
ates@anet.net.tr
Could you please send me the solution: ymailhot@magma.ca
Thank you.
Thank you.
Or can you put here ?
Maybe someone pay the points for an answer .
Maybe someone pay the points for an answer .
Did anyone ever find out how he sorted it out? if so I would love to know
dave.r@monitorwa.com.au
thanks
Dave
dave.r@monitorwa.com.au
thanks
Dave
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
private
{ Private declarations }
procedure WM_SpoolerStatus(var Msg : TWMSPOOLERSTATUS);
message WM_SPOOLERSTATUS;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.WM_SpoolerStatus(va
begin
Label1.Caption := IntToStr(msg.JobsLeft) + ' Jobs currenly in spooler';
msg.Result := 0;
end;