How to simulate Windows shutdown for debugging?

后端 未结 4 1952
北恋
北恋 2020-12-04 16:54

I have an issue with my application when Windows shuts down - my app isn\'t exiting nicely, resulting in the End Task window being displayed. How can I use the debugger to s

4条回答
  •  一整个雨季
    2020-12-04 16:59

    SendMessage can be used to send window messages with any parameters to a window.

    Very useful for debugging and testing.

    1. Send the message WM_QUERYENDSESSION with LPARAM = ENDSESSION_CLOSEAPP. The application must return 1 (TRUE) to indicate it's prepared to shut down and restart.

    2. Send the message WM_ENDSESSION with LPARAM = ENDSESSION_CLOSEAPP The application must shut down within the specified timeout period.

提交回复
热议问题