Events in PrintQueue

妖精的绣舞 提交于 2019-12-08 08:21:09

问题


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 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.


回答1:


As I understand it, ou can handle your OWN print queues (AddJob for example ..) but you cannot intercept the printjobs of other users.




回答2:


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



来源:https://stackoverflow.com/questions/6506916/events-in-printqueue

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!