问题描述
Hello All,
Hello All,
我有一个更长时间运行的托管c ++应用程序(10-20 +天)似乎是间歇性的显示一个对话框崩溃
I have a longer running managed c++ application (10-20+ days) that seems to intermittently crash with a dialog box shown
现在从callstack看起来好像对话框由onidle启动并超时
Now from the callstack it looks as though the dialog gets launched by onidle and times out
崩溃本身似乎发生在另一个组件中,但我注意到这个特定的callstack存在于崩溃的应用程序中,而当应用程序工作时它不存在。
The crash itself seems to happen in another component, but I've noticed this particular piece of callstack is present in crashed applications while it is not there when the application works.
我的问题是:
1。由于我认为我的应用程序没有覆盖onidle,我如何找到导致它显示消息框的原因?
1. Since I believe my application does not override onidle, how do I find what is causing it to show the message box?
2。对话框超时是否会影响任何内容?在具有超时警报的单独组件中进行绘制调用是否会导致错误的事情?
2. Does the dialog timing out affect anything? Would a draw call in a separate component with a timed out alert cause bad things?
3。该应用程序持续很长时间,是否有可能是onidle计数器可以打勾?如果是这样会导致此问题?
3. The app lasts a long time, is it possible that the onidle counter could tick over? If so would that cause this issue?
4。有没有办法查看wndprocexception是什么或可能处理它?
4. Is there a way to view what the wndprocexception was or possibly handle it?
-Andrew
推荐答案
感谢您在此处发帖。
>> 1。由于我认为我的应用程序没有覆盖onidle,我如何找到导致它显示消息框的原因?
2。对话框超时是否会影响任何内容?如果在具有超时警报的单独组件中进行绘制调用会导致不良事件吗?
3。该应用程序持续很长时间,是否有可能是onidle计数器可以打勾?如果是这样会导致此问题?
当应用程序的消息队列为空时,在默认消息循环中调用OnIdle。 OnIdle应返回0表示不需要空闲处理时间。每当在消息队列
为空时调用OnIdle并且每次处理新消息时重置为0,lCount参数都会递增。
OnIdle is called in the default message loop when the application's message queue is empty. OnIdle should return 0 to indicate that no idle processing time is required. The lCount parameter is incremented each time OnIdle is called when the message queue is empty and resets to 0 each time a new message is processed.
如果您不希望在从消息队列中检索消息时调用OnIdle,则可以覆盖CWinThreadIsIdleMessage。如果应用程序设置了非常短的计时器,或者系统正在发送WM_SYSTIMER消息,则OnIdle将重复调用
,并降低性能。
If you do not want OnIdle to be called whenever a message is retrieved from the message queue, you can override the CWinThreadIsIdleMessage. If an application has set a very short timer, or if the system is sending the WM_SYSTIMER message, then OnIdle will be called repeatedly, and degrade performance.
有关更多信息OnIdle方法,您可以参考下面的这个文档。
For more information about OnIdle method, you could refer to this document below.
>> 4。有没有办法查看wndprocexception是什么或可能处理它?
对于这种情况,您可以使用AfxCallWndProc来捕获异常。
For this case, you could use AfxCallWndProc to catch exceptions.
以下是类似的案例参考。
Here is a similar case for you as a reference.
希望这可以帮助你。
最诚挚的问候,
Sera Yu
Best Regards,
Sera Yu
这篇关于Onidle循环导致对话框崩溃MFC,ATL,托管C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!