override Wndproc

abc

New member
Joined
May 14, 2007
Messages
3
Programming Experience
Beginner
Hello Guys,

I'm overriding the wndproc method in my code
to detect when the current windows session is ended.
If the current windows session is ended, my program
will stop the shutdown and execute some code.
After this it will shutdown windows.

Now I want to distinguish between logoff and shutdown.
Is there a way to do that.

Best regards

abc
 
abc,
Isnt there an event that occurs when an app is closing, and the reason why the app is closing is given? Maybe that doesnt distinguish between logoff and shutdown.. *Rusty memory* ;)
 
The Form.Closing event does have a CloseReason where you can determine WindowsShutDown.
Also check SystemEvents.SessionEnding event and the comments there.
Like WM_QUERYENDSESSION that result in WM_ENDSESSION, both mentioned events above is cancelable.
 
Back
Top