作者:手机用户2502876217 | 来源:互联网 | 2023-01-25 12:52
Iamcurrentlyworkingonawin32GUIappthatdoesmostofitsworkinthewindowthread.Thisthre
I am currently working on a win32 GUI app that does most of its work in the window thread.
This thread can sometimes be blocked since it runs a script engine that can be suspended by an external script debugger (another process). This is not a problem most of the time as it is expected behavior.
However, if the user tries to close the window, the app obviously becomes unresponsive and you get the "This application is not responding..." dialog.
My plan was to periodically call back from the "suspend code" to the app and have it do PeekMessage for WM_CLOSE, and if so, terminate the debugger. Unfortunately, from what I can understand, WM_CLOSE it sent directly to the wndproc.
我目前正在开发一个win32 GUI应用程序,它在窗口线程中完成大部分工作。此线程有时可能会被阻止,因为它运行的脚本引擎可以由外部脚本调试器(另一个进程)挂起。这在大多数情况下都不是问题,因为它是预期的行为。但是,如果用户试图关闭窗口,应用程序显然会无响应,并且您会收到“此应用程序没有响应...”对话框。我的计划是定期从“暂停代码”回拨给应用程序,并让它为WM_CLOSE执行PeekMessage,如果是,则终止调试器。不幸的是,根据我的理解,WM_CLOSE直接发送到wndproc。
Is there some other way that I could detect that the user wants to close the window, short of redesigning the app which is not an option?
For example, is there some other message that can be checked for with PeekMessage?
有没有其他方法我可以检测到用户想关闭窗口,没有重新设计应用程序,这不是一个选项?例如,是否可以使用PeekMessage检查其他消息?
4 个解决方案