zoukankan      html  css  js  c++  java
  • 0xC015000F:正被停用的激活上下文不是最近激活的

     

      在网上搜索了一下,先找到一个提示,可以在CApp::InitInstance()中禁用ActivationContext:
      afxAmbientActCtx= FALSE;
      这种做法能“解决”问题,但进一步查证后发现这实际上是隐藏问题。
       Junfeng Zhang在自己的博客中给了比较详细的解释(http://blogs.msdn.com/b/junfeng/archive/2006/03/19/sxs-activation-context-activate-and-deactivate.aspx)。基本上出现这个错误,是因为在代码中抛 出了异常,从而跳过了与Context Activation对应的Deactivation,导致后续调用Deactivation时,发现栈中的Context不对。
      而MSDN 论坛中, 网友MMDev在回答别人的帖子(http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/c3feab0f-601b-4ca6-beb2-8d4d615438cc/)时给出了比较好的解决方案:
      在Visual Studio中,选择Debug | Exceptions菜单项,在弹出的对话框中,勾选所有的Win32 Exceptions,这样在Win32的异常抛出时,程序就会中断,这样就有机会在第一时间(异常处理前)看到自己的代码中发生了什么错误导致抛出异常,从而改正错误,消除程序中的隐患。

  • 相关阅读:
    leetcode 18 4Sum
    leetcode 71 Simplify Path
    leetcode 10 Regular Expression Matching
    leetcode 30 Substring with Concatenation of All Words
    leetcode 355 Design Twitte
    leetcode LRU Cache
    leetcode 3Sum
    leetcode Letter Combinations of a Phone Number
    leetcode Remove Nth Node From End of List
    leetcode Valid Parentheses
  • 原文地址:https://www.cnblogs.com/decode1234/p/6677122.html
Copyright © 2011-2022 走看看