环境
Windows 2008 Server R2 + VS2012 SP1
(注:在WindowsXP + VS2008中返回正常)
winctrl4.cpp
BOOL PASCAL AfxInitRichEdit2()
{
_AFX_RICHEDIT_STATE* pState = _afxRichEditState;
if (pState->m_hInstRichEdit2 == NULL)
pState->m_hInstRichEdit2 = AtlLoadSystemLibraryUsingFullPath(L"RICHED20.DLL");
return pState->m_hInstRichEdit2 != NULL;
}
altcore.h
inline HMODULE AtlLoadSystemLibraryUsingFullPath(_In_z_ const WCHAR *pszLibrary)
{
#if (NTDDI_VERSION >= NTDDI_WIN8)
return(::LoadLibraryExW(pszLibrary, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32));
#else
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(::LoadLibraryW(wszLoadPath));
#endif
}
发现::LoadLibraryExW(pszLibrary, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32) 返回空,无法加载到dll
网上搜索了N多方法,都没有用处。
最后直接更新VS2012
问题解决