Intercept WM_CLOSE for cleanup operations

前端 未结 4 1015
悲哀的现实
悲哀的现实 2021-01-22 06:58

I have an external application that calls my application and is supposed to end it when the job is done. The log from this external application claims it uses WM_CLOSE

4条回答
  •  滥情空心
    2021-01-22 07:33

    You could just handle WM_CLOSE in your message loop to do whatever cleanup is necessary, or even abort the close (by returning 1 instead of 0). See e.g. this: http://cboard.cprogramming.com/windows-programming/141438-handling-wm_close-wm_destroy.html#post1056273

    Edit: for console applications, this may be of interest: http://support.microsoft.com/kb/178893

提交回复
热议问题