BOOL CDllCenter::LoadDLL() { m_mapDll.RemoveAll(); CStringArray arDllPath; if (!GetDllPath(arDllPath)) return FALSE; int nCount = arDllPath.GetCount(); for (int i = 0; i < nCount; i++) { // Load DLL HINSTANCE hr = LoadDllLibrary(arDllPath.GetAt(i)); if (hr == NULL) return FALSE; // Check DLL fpGetGUID fpGUID = (fpGetGUID)LoadDllFun(hr, arDllPath.GetAt(i), _T("GetGUID")); if (fpGUID == NULL) return FALSE; CString strText; strText.LoadString(IDS_GUID_START); TCHAR* tc = new TCHAR[strText.GetLength() + 1]; tc = fpGUID(tc); BOOL bCheck = CheckDllUse(tc, hr); delete[] tc; if (!bCheck) return FALSE; // Init DLL fpInitWnd fpWnd = (fpInitWnd)LoadDllFun(hr, arDllPath.GetAt(i), _T("InitWnd")); if (fpWnd == NULL) return FALSE; CWnd *pWnd = fpWnd(m_pParent); if (!pWnd) return FALSE; MoveDllWndPos(pWnd, m_nDllUseCount); } return TRUE; }
CLoadDll::CLoadDll() { LoadDllFun(); //加载DLL }