BOOL regcom(LPCWSTR strLib)
{
//for registration
HMODULE hLib = ::LoadLibrary(strLib);
if(hLib == 0) {
return FALSE;
}
HRESULT (STDAPICALLTYPE *pDllRegisterServer)();
(FARPROC&)pDllRegisterServer = ::GetProcAddress(hLib, _T("DllRegisterServer"));
if(pDllRegisterServer == NULL) {
::FreeLibrary(hLib);
return FALSE;
}
if(FAILED(pDllRegisterServer ())) {
::FreeLibrary(hLib);
return FALSE;
} else {
::FreeLibrary(hLib);
return TRUE;
}
}
BOOL unregcom(LPCWSTR strLib)
{
HMODULE hLib = ::LoadLibrary(strLib);
if(hLib == 0) {
return FALSE;
}
HRESULT (STDAPICALLTYPE *pDllUnregisterServer)();
(FARPROC&)pDllUnregisterServer = ::GetProcAddress(hLib, _T("DllUnregisterServer"));
if(pDllUnregisterServer == NULL) {
::FreeLibrary(hLib);
return FALSE;
}
if(FAILED(pDllUnregisterServer())) {
::FreeLibrary(hLib);
return FALSE;
} else {
::FreeLibrary(hLib);
return TRUE;
}
}