Events in PrintQueue
ps = new PrintServer(printserverName);
PrintQueue pq1 = new PrintQueue(ps, pq.Name);
As per my understanding, pq1
is a printer Queue which will handle print jobs.
I want to catch events for this print queue.
For example, if user A gives 开发者_Go百科a print then this print job is added into the queue.I want to catch this job added into the queue event.So, I can know how many pages are allowed to user or validating the user.
As I understand it, ou can handle your OWN print queues (AddJob for example ..) but you cannot intercept the printjobs of other users.
Looks like at the win32 API level you have an option to hook up to queue events:
I Could not find the same in .NET unless you keep polling for the job collection for the queue.
Take a look at:
http://msdn.microsoft.com/en-us/library/dd162722(v=vs.85).aspx
PRINTER_CHANGE_JOB
Notify of any changes to a job. You can set this general flag or one or more of the following specific flags:
PRINTER_CHANGE_ADD_JOB PRINTER_CHANGE_SET_JOB PRINTER_CHANGE_DELETE_JOB PRINTER_CHANGE_WRITE_JOB
精彩评论