大意是:
在KB2465361之后。themehelper.cpp 中调用了afxglobals.cpp中的 AfxLoadSystemLibraryUsingFullPath函数。造成afxglobals.obj 的引入。从而产生代码至少增加1.2M。
解决方法
1.卸载KB2465361,这个方法太弱智了。不小心也许又打上了。
2.在你自己的工程的stdafx.cpp中增加以下代码
// this is our own local copy of the AfxLoadSystemLibraryUsingFullPath function
HMODULE AfxLoadSystemLibraryUsingFullPath(const WCHAR *pszLibrary)
{
WCHAR wszLoadPath[MAX_PATH+1];
if (::GetSystemDirectoryW(wszLoadPath, _countof(wszLoadPath)) == 0)
{
return NULL;
}
if (wszLoadPath[wcslen(wszLoadPath)-1] != L'//')
{
if (wcscat_s(wszLoadPath, _countof(wszLoadPath), L"//") != 0)
{
return NULL;
}
}
if (wcscat_s(wszLoadPath, _countof(wszLoadPath), pszLibrary) != 0)
{
return NULL;
}
return(::AfxCtxLoadLibraryW(wszLoadPath));
}
其实这段代码与afxglobals.cpp中的代码一样。目的只是避免引入afxglobals.obj。
这样,你的程序体积又恢复正常了。减肥成功。。。恭喜恭喜。
微软在KB2538241之后已经修复了这个问题。如果以上代码,打了KB2538241之后,会出现link error AfxLoadSystemLibraryUsingFullPath.符号重定义,去掉上述代码即可。