Discussion:
Is FindNextPrinterChangeNotification reliable to catch all notifications ?
(too old to reply)
Andrew
2009-04-14 15:54:52 UTC
Permalink
Hello,

Getting notified of printing events with
FindNextPrinterChangeNotification doesn't seem to me reliable to catch
all notifications.

As soon as the wait function returns from waiting on the handle
(returned by FindFirstPrinterChangeNotification
\FindNextPrinterChangeNotification) it is subject to miss the
notifications until the next wait.

The only solution is to quickly post the data returned by
FindNextPrinterChangeNotification and return to waiting.

But this scenario won't catch ALL of the notifications.
I need to be sure I am catching all the notifications because I need
to know when a printing to file job has finished.
I had the idea to monitor the printing queue but it doesn't seem
reliable because of the reasons pointed above.

Is there a way to make monitoring to catch all 100% or is there any
other way to know the printing to file has finished ?
I am printing to XPS using Microsoft XPS Document Writer.
Christian Kaiser
2009-04-15 14:15:55 UTC
Permalink
Post by Andrew
Hello,
Getting notified of printing events with
FindNextPrinterChangeNotification doesn't seem to me reliable to catch
all notifications.
Have you verified this, or do you just expect that behaviour? If MS
does implement this as a queue, there's no reason why anything should
become lost.



Christian
Andrew
2009-04-15 22:27:13 UTC
Permalink
Post by Christian Kaiser
Post by Andrew
Hello,
Getting notified of printing events with
FindNextPrinterChangeNotification doesn't seem to me reliable to catch
all notifications.
Have you verified this, or do you just expect that behaviour? If MS
does implement this as a queue, there's no reason why anything should
become lost.
Christian
I tested this on the source code of PrintMon http://support.microsoft.com/kb/196805
Put a breakpoint in the code after the call to
FindNextPrinterChangeNotification which returns the info regarding
printer event.
If you don't run the code quickly after the breakpoint is hit, you
won't get the next notifications.
Andrew
2009-04-15 23:57:11 UTC
Permalink
Post by Christian Kaiser
Post by Andrew
Hello,
Getting notified of printing events with
FindNextPrinterChangeNotification doesn't seem to me reliable to catch
all notifications.
Have you verified this, or do you just expect that behaviour? If MS
does implement this as a queue, there's no reason why anything should
become lost.
Christian
I tested this on the source code of PrintMonhttp://support.microsoft.com/kb/196805
Put a breakpoint in the code after the call to
FindNextPrinterChangeNotification which returns the info regarding
printer event.
If you don't run the code quickly after the breakpoint is hit, you
won't get the next notifications.
Also, another way to test is by adding OutputDebugString in the cases
handled in UpdateJobData() in Queue.c
Run it and observe the output. Then, add a Sleep(3000) in
JOB_NOTIFY_FIELD_DOCUMENT case for example. You will see that the
output is smaller.
Andrew
2009-05-13 10:19:44 UTC
Permalink
Post by Andrew
Post by Christian Kaiser
Post by Andrew
Hello,
Getting notified of printing events with
FindNextPrinterChangeNotification doesn't seem to me reliable to catch
all notifications.
Have you verified this, or do you just expect that behaviour? If MS
does implement this as a queue, there's no reason why anything should
become lost.
Christian
I tested this on the source code of PrintMonhttp://support.microsoft.com/kb/196805
Put a breakpoint in the code after the call to
FindNextPrinterChangeNotification which returns the info regarding
printer event.
If you don't run the code quickly after the breakpoint is hit, you
won't get the next notifications.
Also, another way to test is by adding OutputDebugString in the cases
handled in UpdateJobData() in Queue.c
Run it and observe the output. Then, add a Sleep(3000) in
JOB_NOTIFY_FIELD_DOCUMENT case for example. You will see that the
output is smaller.
Anyone knows if FindFirstPrinterChangeNotification
\FindNextPrinterChangeNotification is reliable to known when printing
is finished?

Loading...