本文整理汇总了C++中Registry::Commit方法的典型用法代码示例。如果您正苦于以下问题:C++ Registry::Commit方法的具体用法?C++ Registry::Commit怎么用?C++ Registry::Commit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Registry
的用法示例。
在下文中一共展示了Registry::Commit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DllRegisterServer
STDAPI DllRegisterServer()
{ HRESULT hr = S_OK;
LPCTSTR prodPrefix = NULL;
LPCTSTR compPrefix = NULL;
TCHAR szModulePath[MAX_PATH];
COMServer::GetModuleFileName(szModulePath,sizeof(szModulePath)/sizeof(szModulePath[0]));
VersionInfo verInfo(szModulePath);
prodPrefix = (LPCTSTR)verInfo.GetStringInfo(_T("ProductPrefix"));
compPrefix = (LPCTSTR)verInfo.GetStringInfo(_T("ComponentPrefix"));
try
{ Registry registry;
RegistryUtil::RegisterComObjectsInTypeLibrary(registry,szModulePath,RegistryUtil::AUTO);
if( registry.Prepare() )
registry.Commit();
/*
as marker for registration of multiple typelibs
RegistryUtil::RegisterTypeLib(LIBID_BVR20983_1_SC,LANG_SYSTEM_DEFAULT,_T("1"),1,0,szModulePath,szWindowsDir);
RegistryUtil::RegisterTypeLib(LIBID_BVR20983_1_SC,MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_NEUTRAL), SORT_DEFAULT),_T("2"),1,0,szModulePath,szWindowsDir);
*/
}
catch(BVR20983Exception e)
{ LOGGER_ERROR<<e<<endl;
hr = SELFREG_E_CLASS;
}
catch(exception& e)
{ LOGGER_ERROR<<"Exception "<<typeid(e).name()<<":"<<e.what()<<endl;
hr = SELFREG_E_CLASS;
}
catch(...)
{ LOGGER_ERROR<<_T("Exception")<<endl;
hr = SELFREG_E_CLASS;
}
EvtLogInstall(NULL!=prodPrefix ? prodPrefix : _T("unknown"),NULL!=compPrefix ? compPrefix : _T("unknown"),TRUE,hr);
return hr;
} // of DllRegisterServer()
示例2: DllUnregisterServer
STDAPI DllUnregisterServer()
{ HRESULT hr = S_OK;
LPCTSTR prodPrefix = NULL;
LPCTSTR compPrefix = NULL;
TCHAR szModulePath[MAX_PATH];
COMServer::GetModuleFileName(szModulePath,sizeof(szModulePath)/sizeof(szModulePath[0]));
VersionInfo verInfo(szModulePath);
prodPrefix = (LPCTSTR)verInfo.GetStringInfo(_T("ProductPrefix"));
compPrefix = (LPCTSTR)verInfo.GetStringInfo(_T("ComponentPrefix"));
try
{ Registry registry;
RegistryUtil::RegisterComObjectsInTypeLibrary(registry,szModulePath,RegistryUtil::AUTO);
registry.DeleteKeys();
if( registry.Prepare() )
registry.Commit();
}
catch(BVR20983Exception e)
{ LOGGER_ERROR<<e<<endl;
hr = SELFREG_E_CLASS;
}
catch(exception& e)
{ LOGGER_ERROR<<"Exception "<<typeid(e).name()<<":"<<e.what()<<endl;
hr = SELFREG_E_CLASS;
}
catch(...)
{ LOGGER_ERROR<<_T("Exception")<<endl;
hr = SELFREG_E_CLASS;
}
EvtLogInstall(NULL!=prodPrefix ? prodPrefix : _T("unknown"),NULL!=compPrefix ? compPrefix : _T("unknown"),FALSE,hr);
return hr;
} // of DllUnregisterServer()