16,471
社区成员
发帖
与我相关
我的任务
分享
void CXXApp::RegOCX(CString ocxFile)
{
//装载ActiveX控件
HINSTANCE hLib = LoadLibrary(ocxFile);
if (hLib < (HINSTANCE)HINSTANCE_ERROR)
{
AfxMessageBox("未发现控件!");
return;
}
//获取注册函数DllRegisterServer地址
FARPROC lpDllEntryPoint;
lpDllEntryPoint = GetProcAddress(hLib,_T("DllRegisterServer"));
//调用注册函数DllRegisterServer
if(lpDllEntryPoint!=NULL)
{
if(FAILED((*lpDllEntryPoint)()))
{
AfxMessageBox("控件注册失败!");
FreeLibrary(hLib);
return;
}
//AfxMessageBox("控件注册成功");
}
else
AfxMessageBox("控件注册失败!");
}