CreateEx导致未处理的异常停用的激活上下文不是最近激活的一个 [英] CreateEx Causes Unhandled exception The activation context being deactivated is not the most recently activated one

查看:182
本文介绍了CreateEx导致未处理的异常停用的激活上下文不是最近激活的一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

itsAnalysisDataTable.CreateEx( WS_EX_CLIENTEDGE, AfxRegisterWndClass( CS_DBLCLKS, LoadCursor( NULL, IDC_ARROW ), (HBRUSH)::GetStockObject( NULL_BRUSH ), NULL ), "AnalysiysTable", WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, dialogItemRect, this, IDC_ANALYSIS_DATA_TABLE );

这条线花了我两天的时间,没有解决办法. itsAnalysisDataTable是一个自定义Windows控件,具有CWnd作为其Grand Grand Grand Parent.该控件已成功以其他方式成功使用,而我们的代码中没有任何问题. 是一个CPropertyPage.

This line has cost me two days of effort with no solution. itsAnalysisDataTable is a custom windows control having CWnd as its grand grand grand parent. The control has been successfully used in other paces without issues in our code. this is a CPropertyPage.

我遇到的问题是线路原因(并且每次都会这样做) MyProduct(x64).exe中0x76f7fd5c处未处理的异常:0xC015000F:停用的激活上下文不是最近激活的上下文.

The problem I have is the line causes (and it does it every time) an Unhandled exception at 0x76f7fd5c in MyProduct (x64).exe: 0xC015000F: The activation context being deactivated is not the most recently activated one.

该异常也发生在32位中.我在Windows 7 x64和VS 2008上.

The exception occurs in 32-bit as well. I'm on Windows 7 x64, VS 2008.

我已经尝试过的:

  1. 在调试器中启用Win32异常中断.没有异常发生(除了偶然的例外,在我们的代码中有很多例外,并且没有任何作用)
  2. 重新编译整个项目
  3. 调试控件的OnCreate处理程序以获取异常.

调用堆栈:

ntdll.dll!0000000076f7fd5c()    
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll] 
kernel32.dll!0000000076df42d3()     
mfc90d.dll!AfxDeactivateActCtx(unsigned long dwFlags=0, unsigned __int64 ulCookie=2077018657900210161)  Line 260 + 0x19 bytes   C++

观察:

  1. 如果我跳过WS_CHILD标志,则不会发生异常,但是控件上也不会调用OnCreate!
  2. 如果我忽略异常并继续运行,则应用程序可以正常运行,控件也可以正常运行.
  3. 在应用程序初始化期间调用AfxSetAmbientActCtx(FALSE)可抑制该异常.但是我认为这是一个hack,除非我能证明它是正当的.

推荐答案

在遇到很多问题之后,我发现跟踪根本问题的简单方法是转到Debug-> Exceptions并启用ALL Throwd异常.然后,您会发现还有其他一些异常正在触发,被静默捕获,但搞乱了激活上下文.修复第一个异常后,激活上下文异常将不会发生.

After hitting a lot of these, I've found the simple way to track down the root issue is to go to Debug -> Exceptions and enable ALL Thrown exceptions. Then you'll find there is some other exception that is firing, being silently caught, BUT messing up the activation context. Once you fix the first exception, the activation context exception won't happen.

这篇关于CreateEx导致未处理的异常停用的激活上下文不是最近激活的一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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