I have a program that uses an external process to complete its work using ProcessName.Start()
, the problem is that when windows is shutting down I want to know that it is shutting down before starting the process, because if the application start the process while shutting down windows shows a message that the process was unable to start correctly (ERROR CODE 0xc0000142).
The main Application is a C# Windows forms application with a notification icon, and the external process is a native console application written in old C (and that is for a good reason).
I used some System events like SessionEnding, and overridden the WndProc to handle windows messages but without success, the application receive these events and messages somewhat late and the application would have started the process and the Error message is shown.
I hope someone can help me on this.
Thnx