静默安装控件
QString modulePathName = QCoreApplication::applicationDirPath() + "\\控件名称.oxc";//控件路径
bool bReg = true;
HINSTANCE hLib = LoadLibraryEx((LPCWSTR)modulePathName.data(), NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
if (hLib < (HINSTANCE)HINSTANCE_ERROR)
return false;
//获取注册函数DllRegisterServer地址
FARPROC lpDllEntryPoint;
if (!bReg)
lpDllEntryPoint = GetProcAddress(hLib, "DllUnregisterServer");
else
lpDllEntryPoint = GetProcAddress(hLib, "DllRegisterServer");
//调用注册函数DllRegisterServer
if (lpDllEntryPoint == NULL)
{
FreeLibrary(hLib);
return false;
}
if (FAILED((*lpDllEntryPoint)()))
{
FreeLibrary(hLib);
return false;
}
FreeLibrary(hLib);
return true;
只想当咸鱼的程序员