bcb在代码注册控件的步骤
在代码里可以如下注册:
void __fastcall TIEHookForm::OnRegisterReg()
{
//ActiveX控件的路径及文件名
LPCTSTR pszDllName="IEEventHookPrj.dll";
//装载ActiveX控件
HINSTANCE hLib = LoadLibrary(pszDllName);
if (hLib < (HINSTANCE)HINSTANCE_ERROR)
{
ShowMessage("不能载入Dll文件!");
return;
}
//获取注册函数DllRegisterServer地址
FARPROC lpDllEntryPoint;
lpDllEntryPoint = GetProcAddress(hLib,("DllRegisterServer"));
//调用注册函数DllRegisterServer
if(lpDllEntryPoint!=NULL)
{
if(FAILED((*lpDllEntryPoint)()))
{
ShowMessage("调用DllRegisterServer失败!");
FreeLibrary(hLib);
return;
}
// ShowMessage("注册成功");
}
else
ShowMessage("调用DllRegisterServer失败!");
}
本文地址:http://www.45fan.com/a/question/71365.html