OnMDIActivate多次调用 [英] OnMDIActivate called multiple times

查看:151
本文介绍了OnMDIActivate多次调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


这是关于在VS2015中使用多个Doc / View架构的MFC应用程序。


1)创建一个使用VS2015中的默认值的新MFC项目。


2)覆盖ChildFrm.cpp中的函数  OnMDIActivate,并在消息映射中添加ON_WM_MDIACTIVATE()。


3)创建一个新文档,然后创建第二个新文档并观察OnMDIActivate中的电话。



该功能是使用以下参数调用6次:




- bActivate = 0,pActivateWnd = 0x00010abc,pDeactivateWnd = 0x00080a46



- bActivate = 1,pActivateWnd = 0x00010abc,pDeactivateWnd = 0x00080a46



- bActivate = 0,pActivateWnd = 0x00080a46,pDeactivateWnd = 0x00010abc



- bActivate = 1,pActivateWnd = 0x00080a46,pDeactivateWnd = 0x00010abc



- bActivate = 0,pActivateWnd = 0x00010abc,pDeactivateWnd = 0x00080a46



- bActivate = 1,pActivateWnd = 0x00010abc,pDeactivateWnd = 0x00080a46


最后一次通话是正确的。句柄0x00010abc对应于最后一个活动的新窗口。


然而,第4个调用显示旧窗口再次被激活,这导致我的应用程序出现问题。


VS2008中的行为不一样。在VS2008中有4个调用,pActivateWnd参数始终是被激活的窗口。


有没有解决方法?


谢谢!

解决方案

你好朋友


由于这个问题与C ++开发有关,我会移动这个线程到
VC ++论坛为您获得专业答案。


您的理解与合作将不胜感激。


 


问候,


Fletcher



Hi,

This is about an MFC application using a multiple Doc/View architecture in VS2015.

1) Create a new MFC project using the default values in VS2015.

2) Override the function OnMDIActivate in ChildFrm.cpp and add ON_WM_MDIACTIVATE() in the message map.

3) Create a new document and then create a second new document and observe the calls in OnMDIActivate .

The function is called 6 times with the following parameters:

- bActivate = 0, pActivateWnd = 0x00010abc, pDeactivateWnd = 0x00080a46

- bActivate = 1, pActivateWnd = 0x00010abc, pDeactivateWnd = 0x00080a46

- bActivate = 0, pActivateWnd = 0x00080a46, pDeactivateWnd = 0x00010abc

- bActivate = 1, pActivateWnd = 0x00080a46, pDeactivateWnd = 0x00010abc

- bActivate = 0, pActivateWnd = 0x00010abc, pDeactivateWnd = 0x00080a46

- bActivate = 1, pActivateWnd = 0x00010abc, pDeactivateWnd = 0x00080a46

The final call, is correct. The handle 0x00010abc corresponds to the new window that is the last one active.

However, the 4th call shows the old window being activated again and that causes a problem in my application.

This behavior was not the same in VS2008. In VS2008 there were 4 calls and the pActivateWnd parameter was always of the windows being activated.

Is there any workaround to this ?

Thanks!

解决方案

Hi friend

As this issue is more related to C++ developing, I will move this thread to VC++ forum for you to get a professional answer.

Your understanding and cooperation will be grateful.

 

Regards,

Fletcher


这篇关于OnMDIActivate多次调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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