C++: cleanup actions in response to Windows logoff

杀马特。学长 韩版系。学妹 提交于 2019-12-05 21:05:28
Neil

WM_ENDSESSION processing doesn't actually give your application a chance to exit the message loop. You should assume the system calls TerminateProcess after sending the WM_ENDSESSION message.

Therefore, any clean-up your application needs to perform should be done before returning from the window procedure.

In Windows UI applications, you can use: LRESULT CMainDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{ if(message == WM_ENDSESSION) { if(lParam == ENDSESSION_LOGOFF) { /*Handle event*/ } } return CDialogEx::WindowProc(message, wParam, lParam); }
You can get more help from this msdn link.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!