Windows监控打印机任务实现付费打印

如何拦截打印任务

参考:

  • Intercept any print job and prompt for password.

    FindFirstPrinterChangeNotification()
    FindNextPrinterChangeNotification()
    if pdwChange = PRINTER_CHANGE_ADD_JOB you get the Job ID from PRINTER_NOTIFY_INFO_DATA
    You pause the Job with
    SetJob() and JOB_CONTROL_PAUSE
    You call your Dialog Box, then

    you resume the Job with
    SetJob() and JOB_CONTROL_RESUME
    or you cancel it with
    SetJob() and JOB_CONTROL_DELETE

  • Monitor jobs in a printer queue (.NET)

    There is a lot of code available in the internet (CodeProject as well as other sites) about the API calls to do print spool monitoring. However, I was not able to find any code that would help the user to enable monitoring one or more print queues with minimal code changes. So, I created a class (PrintQueueMonitor) that would allow the user to monitor the print queue for job changes and raise an event as and when jobs get added to the queue or job status gets changed in the queue.

发表评论