What to do after crash of Spooler-Service

Dec 22, 2009 at 11:39 AM

Hi together

I have a problem: I use the PrintQueueWatch-Component. This is realy working great. But I have the fallowing question: When the SpoolerService of Windows is crashing (or stopped) and after it is restarted, what does I have to do, that the PrintQueueWatch is working on? - I have now try to call Disconnect to remove all Monitored Printers. After the restart of the SpoolerService I add the printers to monitor on. But now, I dont get any events for example for job added. I have also tried to dispose the component and create it new and add the printers. It will also not working on.

Can anybody give me a tip?

Thank you!

Best Regards, Thomas

Jan 22, 2010 at 8:01 PM

I've got the exact same problem. If I get an "unknown status change" from the PrinterInformationChangedEvent, I go to "recovery logic" where I disconnect the monitor, dispose it and then go through the intialization process all over again (creating a new instance of the monitor, wiring up the events, setting the appropriate property values) to no avail. It will no longer receive add/set/written/deleted events unless I manually restart my service. I have seen this issue posted on the CodeProject site more than once and on here as well and never any answers or suggestions.

This is a huge issue as the "unknown status change" can be received from even simple circumstances like the printer waking from sleep mode.

Any help or insight would be greatly appreciated.



Jan 23, 2010 at 9:21 AM

You will have to set the component tracing  to it's highest level and see if you can see (a) what the unknown status number is - possibly it could be handled instead of causing problems and (b) that the disconnecting and disposing code is executing without any problem and cleaning up all the OS handles it used and not trying to reuse them. 

e.g. is FindClosePrinterChangeNotification failing and is hChange being cleared down so that it goes through OpenPrinter again the next time?

See http://msdn.microsoft.com/en-us/library/dd162721(VS.85).aspx

Jan 25, 2010 at 8:02 AM


I have found the problem.
When the spooler crashed the Sub StartThread in the EventQueue will be canceled. After that the flag _Cancelled of the EventQueue will still be at true. I have now added a method Init on the EventQueue which will set _Cancelled to false.