0xc015000f: the activation context being deactivated is not recently activated

While the program was running, this error popped up, calling functions on the stack, and it was very confusing.

After searching on the Internet, I found a prompt to disable the ActivationContext:
afxAmbientActCtx= FALSE in CApp::InitInstance().
this “solves” the problem, but upon closer inspection it turns out to be a hidden problem.
Junfeng Zhang in their blog to the comparatively detailed explanation (http://blogs.msdn.com/b/junfeng/archive/2006/03/19/sxs-activation-context-activate-and-deactivate.aspx). Basically, this error occurred because an exception was thrown in the code, which skipped the Deactivation corresponding to Context Activation, leading to subsequent Deactivation and the discovery that the Context in the stack was incorrect.
the MSDN BBS, net friend MMDev in response to someone else’s post (http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/c3feab0f-601b-4ca6-beb2-8d4d615438cc/) gives a better solution:
in Visual Studio, the choice of the Debug | Exceptions menu items, in the pop-up dialog, check all the Win32 Exceptions to this exception is thrown in Win32, the program will interrupt, so you have the opportunity to () before the exception handling in the first time to see what happened in your own code error exception is thrown, so as to correct errors, eliminate hidden dangers in the program.

Read More: