detecting logoff vs shutdown. WM_Endsession ??
-
:confused:Dear All, I am developing an dialog based application using MFC VC++ Version 6.0 for Windows 2000. The application needs to perform certain tasks immediately before logging off /shutdown of the system respectively. For detecting logoff/shutdown i have handled WM_ENDSESSION event. OnEndSession call informs the CWnd object whether the session is actually ending and this event is fired for both logoff as well as for shutdown. I need to detect the difference between log off event and shutdown event because I need to perform seperate functions on logoff and shutdown. Am I capturing the right event for handling this issue ? Also if possible please suggest any alternate way to perform the same. Waiting for your reply. Regards, Rohit
-
:confused:Dear All, I am developing an dialog based application using MFC VC++ Version 6.0 for Windows 2000. The application needs to perform certain tasks immediately before logging off /shutdown of the system respectively. For detecting logoff/shutdown i have handled WM_ENDSESSION event. OnEndSession call informs the CWnd object whether the session is actually ending and this event is fired for both logoff as well as for shutdown. I need to detect the difference between log off event and shutdown event because I need to perform seperate functions on logoff and shutdown. Am I capturing the right event for handling this issue ? Also if possible please suggest any alternate way to perform the same. Waiting for your reply. Regards, Rohit
Hi Rohit, When Logoff or Shutdown events occur it goes in WM_QUERYENDSESSION which in turn sends WM_ENDSESSION. So as per your need you can distinguish using the lparam value. If it is ENDSESSION_LOGOFF it is LogOff event and if EWX_LOGOFF it is ShutDown Event as per my observation and Testing. Pankaj