萌克力
试问mfc资源能加载了吗
MFC的DLL,这样处理一下就行了,需要重定向一下入口函数
// export DllMain for the DLL
extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
BOOL bResult = FALSE;
#ifdef _AFXDLL
// wire up resources from core DLL
AfxCoreInitModule();
#endif
_AFX_THREAD_STATE* pState = AfxGetThreadState();
AFX_MODULE_STATE* pPrevModState = pState->m_pPrevModuleState;
// Initialize DLL's instance(/module) not the app's
if (!AfxWinInit(hInstance, NULL, _T(""), 0))
{
AfxWinTerm();
goto Cleanup; // Init Failed
}
// initialize the single instance DLL
CWinApp* pApp; pApp = AfxGetApp();
if (pApp != NULL && !pApp->InitInstance())
{
pApp->ExitInstance();
AfxWinTerm();
goto Cleanup; // Init Failed
}
pState->m_pPrevModuleState = pPrevModState;
#ifdef _AFXDLL
// wire up this DLL into the resource chain
VERIFY(AfxInitExtensionModule(controlDLL, hInstance));
CDynLinkLibrary* pDLL; pDLL = new CDynLinkLibrary(controlDLL);
ASSERT(pDLL != NULL);
#else
AfxInitLocalData(hInstance);
#endif
bResult = TRUE;
Cleanup:
pState->m_pPrevModuleState = pPrevModState;
#ifdef _AFXDLL
// restore previously-saved module state
VERIFY(AfxSetModuleState(AfxGetThreadState()->m_pPrevModuleState) ==
&afxModuleState);
DEBUG_ONLY(AfxGetThreadState()->m_pPrevModuleState = NULL);
#endif
return bResult;
}
else if (dwReason == DLL_PROCESS_DETACH)
{
#ifdef _AFXDLL
// set module state for cleanup
ASSERT(AfxGetThreadState()->m_pPrevModuleState == NULL);
AfxGetThreadState()->m_pPrevModuleState =
AfxSetModuleState(&afxModuleState);
#endif
CWinApp* pApp = AfxGetApp();
if (pApp != NULL)
pApp->ExitInstance();
#ifdef _DEBUG
// check for missing AfxLockTempMap calls
if (AfxGetModuleThreadState()->m_nTempMapLock != 0)
{
TRACE1("Warning: Temp map lock count non-zero (%ld).\n",
AfxGetModuleThreadState()->m_nTempMapLock);
}
#endif
AfxLockTempMaps();
AfxUnlockTempMaps(-1);
// terminate the library before destructors are called
AfxWinTerm();
#ifdef _AFXDLL
AfxTermExtensionModule(controlDLL, TRUE);
#else
AfxTermLocalData(hInstance, TRUE);
#endif
}
else if (dwReason == DLL_THREAD_DETACH)
{
AFX_MANAGE_STATE(&afxModuleState);
#ifdef _DEBUG
// check for missing AfxLockTempMap calls
if (AfxGetModuleThreadState()->m_nTempMapLock != 0)
{
TRACE1("Warning: Temp map lock count non-zero (%ld).\n",
AfxGetModuleThreadState()->m_nTempMapLock);
}
#endif
AfxLockTempMaps();
AfxUnlockTempMaps(-1);
AfxTermThread(hInstance);
}
return TRUE;
}
#ifdef _AFXDLL