O
oswindsa
Guest
Hello,
"The app is preventing shutdown." is thrown when windows is shutting down and clicking "Shutdown anyway" option only kills the application.
We have used an API OnQueryEndSession in our desktop application to save the task before windows could terminate the session.
Code snippet below(2 functions):
LRESULT ClassName::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
return CMDIFrameWnd::WindowProc(message, wParam, lParam);
}
BOOL ClassName::OnQueryEndSession()
{
if (!CMDIFrameWnd::OnQueryEndSession())
return FALSE;
/*code to save application data/tasks*/
}
Debugging in older versions of Windows, while shut down is done "WM_QUERYENDSESSION" message is received from windows and its associated lParam value is 0 and wparam is 0.
Also CMDIFrameWnd::OnQueryEndSession() returns non-zero value so it goes further to do all the other tasks and sends TRUE at the end so that window can shut down.
But from windows 10 (version 1709) whenever windows sends the message as WM_QUERYENDSESSION its associated lParam value is 1 and wparam is 0.
And CMDIFrameWnd::OnQueryEndSession() returns 0 value and it sends False to windows and application never let the windows to shut down until you click "shut down anyway".
Can someone guide me on what change is done or if something i am missing here? Any pointers would be helpful.
Regards,
Oswin
Continue reading...
"The app is preventing shutdown." is thrown when windows is shutting down and clicking "Shutdown anyway" option only kills the application.
We have used an API OnQueryEndSession in our desktop application to save the task before windows could terminate the session.
Code snippet below(2 functions):
LRESULT ClassName::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
return CMDIFrameWnd::WindowProc(message, wParam, lParam);
}
BOOL ClassName::OnQueryEndSession()
{
if (!CMDIFrameWnd::OnQueryEndSession())
return FALSE;
/*code to save application data/tasks*/
}
Debugging in older versions of Windows, while shut down is done "WM_QUERYENDSESSION" message is received from windows and its associated lParam value is 0 and wparam is 0.
Also CMDIFrameWnd::OnQueryEndSession() returns non-zero value so it goes further to do all the other tasks and sends TRUE at the end so that window can shut down.
But from windows 10 (version 1709) whenever windows sends the message as WM_QUERYENDSESSION its associated lParam value is 1 and wparam is 0.
And CMDIFrameWnd::OnQueryEndSession() returns 0 value and it sends False to windows and application never let the windows to shut down until you click "shut down anyway".
Can someone guide me on what change is done or if something i am missing here? Any pointers would be helpful.
Regards,
Oswin
Continue reading...