退出应用程序时未调用CWinAppEx :: ExitInstance() [英] CWinAppEx::ExitInstance() not called when exiting application

查看:355
本文介绍了退出应用程序时未调用CWinAppEx :: ExitInstance()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

退出VC9应用程序时,我遇到了问题,并且发现MFC示例"VisualStudioDemo"中也出现了问题.问题是,到目前为止,我只看到问题在我的PC上发生;我的两个同事根本没有遇到问题.

无论如何,以下是在VisualStudioDemo中重现的步骤:
1.在CVisualStudioDemoApp :: ExitInstance()中放置一个断点
2.调试应用程序
3.在应用程序中,创建一个新文档,因此现在有两个选项卡打开
4.退出应用程序.它没有达到断点.

它似乎卡在AfxInternalPumpMessage()中.如果我从不在应用程序中创建新文档,则退出不会有问题.

到目前为止,我是唯一一个遇到问题的人,这表明我的MFC DLL可能有问题,但如果可能,我希望第二个意见!更好的是确认其他人是否遇到了问题...

感谢您的帮助.

Hi

I have a problem with my VC9 application when I exit it, and I found that the problem also occurs in the MFC sample ''VisualStudioDemo''. Problem is, so far I''ve only seen the problem occur on my PC; two of my colleagues don''t get the problem at all.

Anyway here are the steps to reproduce in VisualStudioDemo:
1. Put a breakpoint in CVisualStudioDemoApp::ExitInstance()
2. Debug the application
3. In the application, create a new document, so there are two tabs open now
4. Exit the application. It doesn''t hit the breakpoint.

It seems to be stuck in AfxInternalPumpMessage(). It does not have a problem exiting if I never create a new document in the application.

The fact that I am the only one so far who gets the problem tells me maybe something is wrong with my MFC DLLs but I would like a second opinion if possible! Even better would be confirmation that someone else gets the problem...

Thanks for any help.

推荐答案

我没有使用过演示应用程序,但是可能是因为它弹出了一个对话框,询问您是否要保存文档?可能是对话框不在屏幕上还是以某种方式隐藏了?
I haven''t used the demo app, but could it be that it has popped up a dialog asking if you want to save the document? May be the dialog is off screen or hidden in some way?


好,我明白了.

我将PreTranslateMessage放在应用程序类中,发现它正与应用程序工具栏(CMFCToolbar)中的WM_TIMER消息重击.

我在afxtoolbar.cpp中浏览了一下,确实在OnMouseMove中设置了计时器并将其终止(可能是在指针悬停于其上方时突出显示该按钮).

计时器ID在afxtoolbar.cpp中定义为AFX_ACCELERATOR_NOTIFY_EVENT = 20,这与我在PreTranslateMessage中获得的lParam相同.
我并不想真的为工具栏类弄混,但快速浏览AFX_ACCELERATOR_NOTIFY_EVENT的Google便使我想到了这篇文章:

http://connect.microsoft.com/VisualStudio/feedback/details/529735/mfc-feature-pack-cmfcmenubar-issue [ ^ ]

在其中,一种变通方法似乎对我有用.我不会在这里粘贴它以防万一它们的末尾有什么变化,但是如果您想阅读它,该链接应该可以将您带到那里.

非常感谢提出建议的每个人.
OK I got it.

I put PreTranslateMessage in the application class, and found it was getting hammered with WM_TIMER messages from the application toolbar (an CMFCToolbar).

I had a quick look in afxtoolbar.cpp and indeed there are timers set and killed in OnMouseMove (probably something about highlighting the button while the pointer is over it).

The timer ID is defined in afxtoolbar.cpp as AFX_ACCELERATOR_NOTIFY_EVENT = 20, which is the same as what I was getting in PreTranslateMessage as the lParam.

I didn''t really want to muck about with the toolbar class but a quick Google of AFX_ACCELERATOR_NOTIFY_EVENT pointed me to this article:

http://connect.microsoft.com/VisualStudio/feedback/details/529735/mfc-feature-pack-cmfcmenubar-issue[^]

In there is a workaround which seems to work for me. I won''t paste it here in case something changes at their end, but the link should get you there if you want to read about it.

Thanks very much everyone who made suggestions.


这篇关于退出应用程序时未调用CWinAppEx :: ExitInstance()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆