前提:
CString strInstanceName;
DWORD run;
程序在下面代码的第二行崩了-.-,提示 “0xC015000F:正被停用的激活上下文不是最近激活的”
CString strTemp;
strTemp.Format(L"##--------item(%s) can't be deleted cause it's state is(%s)", strInstanceName, run);OutputDebugString(strTemp);
网上搜了一下,看到了关键字:内存越界,内存泄漏。
内存越界......啊,格式,DWORD格式要用%u。改成:
CString strTemp;
strTemp.Format(L"##--------item(%s) can't be deleted cause it's state is(%u)", strInstanceName, run);OutputDebugString(strTemp);
好了~
扩:
“0xC015000F:正被停用的激活上下文不是最近激活的”这种错误应对方式可以是:
1.CWinApp::InitInstance(); afxAmbientActCtx = false;//此方法不一定好使,可能导致代码其它部分出错。
2.Debug时把所有异常抛出,然后看哪里有问题,处理。