且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

退出应用程序时未调用CWinAppEx :: ExitInstance()

更新时间:2022-04-12 21:06:40

我没有使用过演示应用程序,但是可能是因为它弹出了一个对话框,询问您是否要保存文档?可能是对话框不在屏幕上还是以某种方式隐藏了?
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.