本文整理汇总了C++中DllRegisterServer函数的典型用法代码示例。如果您正苦于以下问题:C++ DllRegisterServer函数的具体用法?C++ DllRegisterServer怎么用?C++ DllRegisterServer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DllRegisterServer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DllInstall
STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCmdLine)
{
HRESULT hr = E_FAIL;
// MSVC will call "regsvr32 /i:user" if "per-user registration" is set as a
// linker option - so handle that here (its also handle for anyone else to
// be able to manually install just for themselves.)
static const wchar_t szUserSwitch[] = L"user";
if (pszCmdLine != NULL)
{
if (_wcsnicmp(pszCmdLine, szUserSwitch, _countof(szUserSwitch)) == 0)
{
AtlSetPerUserRegistration(true);
// But ATL still barfs if you try and register a COM category, so
// just arrange to not do that.
_AtlComModule.m_ppAutoObjMapFirst = _AtlComModule.m_ppAutoObjMapLast;
}
}
if (bInstall)
{
hr = DllRegisterServer();
if (FAILED(hr))
{
DllUnregisterServer();
}
}
else
{
hr = DllUnregisterServer();
}
return hr;
}
示例2: DllInstall
/*----------------------------------------------------------------------------------------------
Adds/Removes entries to the system registry per user per machine
----------------------------------------------------------------------------------------------*/
STDAPI DLLEXPORT__ DllInstall(BOOL fInstall, LPCWSTR pszCmdLine)
{
ENTER_DLL();
HRESULT hr = E_FAIL;
#if WIN32 // TODO-Linux
static const wchar_t szUserSwitch[] = _T("user");
if (pszCmdLine != NULL)
{
if (_wcsnicmp(pszCmdLine, szUserSwitch, _countof(szUserSwitch)) == 0)
{
ModuleEntry::SetPerUserRegistration(true);
}
}
if (fInstall)
{
hr = DllRegisterServer();
if (FAILED(hr))
{
DllUnregisterServer();
}
}
else
{
hr = DllUnregisterServer();
}
#endif // WIN32
return hr;
}
示例3: DllMain
//
// for MFC initialization
//
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
switch(dwReason)
{
case DLL_PROCESS_ATTACH:
_hdllInstance = hInstance;
if(!AfxInitExtensionModule(DesignCtrSampleDll, hInstance))
return 0;
new CDynLinkLibrary(DesignCtrSampleDll);
_Module.Init(ObjectMap, hInstance);
//
registerAppInfo(hInstance);
DllRegisterServer();
break;
case DLL_PROCESS_DETACH:
AfxTermExtensionModule(DesignCtrSampleDll);
_Module.Term();
break;
}
return 1;
}
示例4: DllRegisterServer
STDAPI DllRegisterServer()
{
if (!IsWindowsVistaOrGreater())
return E_FAIL;
return DllRegisterServer(true);
}
示例5: DllMain
// Library entry point. When you register a browser helper object, it will be
// looaded by both IE and Windows Explorer. We want nothing to do with Windows
// Explorer, so we refuse to load when it calls us.
BOOL APIENTRY DllMain(
HMODULE hModule, DWORD dwReason, LPVOID lpReserved
) {
TCHAR pszLoader[MAX_PATH];
OpenLog();
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
hDllModule = hModule;
DllRegisterServer();
GetModuleFileName(NULL, pszLoader, MAX_PATH);
_tcslwr_s(pszLoader, MAX_PATH);
if (_tcsstr(pszLoader, _T("explorer.exe")))
{
return FALSE;
}
ActiveScriptSite_CreateFactory();
OnDocument_CreateFactory(hModule);
ObjectWithSite_CreateFactory();
ScriptContext_CreateFactory();
Observable_CreateFactory();
hDllModule = hModule;
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
示例6: DllInstall
// DllInstall - Adds/Removes entries to the system registry per user
// per machine.
STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCmdLine)
{
HRESULT hr = E_FAIL;
static const wchar_t szUserSwitch[] = _T("user");
if (pszCmdLine != NULL)
{
if (_wcsnicmp(pszCmdLine, szUserSwitch, _countof(szUserSwitch)) == 0)
{
AtlSetPerUserRegistration(true);
}
}
if (bInstall)
{
hr = DllRegisterServer();
if (FAILED(hr))
{
DllUnregisterServer();
}
}
else
{
hr = DllUnregisterServer();
}
return hr;
}
示例7: DllMain
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
DllRegisterServer();
return TRUE;
}
示例8: DllMain
extern "C" BOOL __stdcall DllMain(HINSTANCE hinstance, DWORD reason, void* pv)
{
if (DLL_PROCESS_ATTACH == reason)
{
ghInstance = hinstance;
DllRegisterServer();
}
return 1;
}
示例9: InitApplication
// Init this application. Register your
// commands, reactors...
void InitApplication()
{
if (FAILED(DllRegisterServer()))
acutPrintf("\nFailed to register.");//dbx safe
// NOTE: DO NOT edit the following lines.
//{{AFX_ARX_INIT
AddCommand("ASDKETRANSMIT", "ADDNOTIFIER", "ADDNOTIFIER", ACRX_CMD_SESSION, AsdkeTransmitAddNotifier);
AddCommand("ASDKETRANSMIT", "REMOVENOTIFIER", "REMOVENOTIFIER", ACRX_CMD_SESSION, AsdkeTransmitRemoveNotifier);
//}}AFX_ARX_INIT
// TODO: add your initialization functions
}
示例10: _tWinMain
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
tstring strFileName = ZYM::CPath::GetAppPath() + _T("ImageOleCtrl.dll");
BOOL bRet = DllRegisterServer(strFileName.c_str()); // 注册COM组件
if (!bRet)
{
::MessageBox(NULL, _T("COM组件注册失败,应用程序无法完成初始化操作!"), _T("提示"), MB_OK);
return 0;
}
HRESULT hRes = ::OleInitialize(NULL);
//HRESULT hRes = ::CoInitialize(NULL);
// If you are running on NT 4.0 or higher you can use the following call instead to
// make the EXE free threaded. This means that calls come in on a random RPC thread.
// HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
ATLASSERT(SUCCEEDED(hRes));
// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
::DefWindowProc(NULL, 0, 0, 0L);
AtlInitCommonControls(ICC_BAR_CLASSES); // add flags to support other controls
HMODULE hRichEditDll = ::LoadLibrary(CRichEditCtrl::GetLibraryName()); // 加载RichEdit控件DLL
hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
CSkinManager::Init(); // 初始化皮肤管理器
tstring strSkinPath = ZYM::CPath::GetAppPath() + _T("Skins\\"); // 设置皮肤文件夹路径
CSkinManager::GetInstance()->SetSkinPath(strSkinPath.c_str());
CSkinManager::GetInstance()->LoadConfigXml(); // 加载皮肤列表配置文件
int nRet = Run(lpstrCmdLine, nCmdShow);
CSkinManager::UnInit(); // 反初始化皮肤管理器
if (hRichEditDll != NULL) // 卸载RichEdit控件DLL
{
::FreeLibrary(hRichEditDll);
hRichEditDll = NULL;
}
_Module.Term();
//::CoUninitialize();
::OleUninitialize();
return nRet;
}
示例11: ImplWinMain
static void ImplWinMain()
{
int argc = 0;
LPWSTR* argv = CommandLineToArgvW(GetCommandLine(), &argc);
if (!argv)
return;
if ((argc >= 2) && (argc <= 5))
{
if (wcscmp(argv[1], L"/automation") == 0)
AutomationMain();
else if (wcscmp(argv[1], L"unregserver") == 0)
DllUnregisterServer();
else if (wcscmp(argv[1], L"regserver") == 0)
DllRegisterServer();
}
LocalFree(argv);
}
示例12: DllInstall
// DllInstall - Adds/Removes entries to the system registry per user per machine.
STDAPI DllInstall(BOOL bInstall, _In_opt_ LPCWSTR pszCmdLine)
{
UNREFERENCED_PARAMETER(pszCmdLine);
HRESULT hr = E_FAIL;
static const wchar_t szUserSwitch[] = L"user";
if (bInstall)
{
hr = DllRegisterServer();
if (FAILED(hr))
{
DllUnregisterServer();
}
}
else
{
hr = DllUnregisterServer();
}
return hr;
}
示例13: DllInstall
/**
* DllInstall - Adds/Removes entries to the system registry per user per machine.
*/
STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCmdLine)
{
logger->debug(L"BHO::dllexports::DllInstall");
HRESULT hr = E_FAIL;
static const wchar_t szUserSwitch[] = L"user";
if (pszCmdLine != NULL) {
if (_wcsnicmp(pszCmdLine, szUserSwitch, _countof(szUserSwitch)) == 0) {
ATL::AtlSetPerUserRegistration(true);
}
}
if (bInstall) {
hr = DllRegisterServer();
if (FAILED(hr)) {
DllUnregisterServer();
}
} else {
hr = DllUnregisterServer();
}
return hr;
}
示例14: DllInstall
HRESULT
DllInstall(BOOL bInstall,
LPCWSTR pszCmdLine)
{
if (pszCmdLine && *pszCmdLine != '\0')
wcstombs(event_source, pszCmdLine, sizeof(event_source));
/*
* This is an ugly hack due to the strange behavior of "regsvr32 /i".
*
* When installing, regsvr32 calls DllRegisterServer before DllInstall.
* When uninstalling (i.e. "regsvr32 /u /i"), on the other hand, regsvr32
* calls DllInstall and then DllUnregisterServer as expected.
*
* This strange behavior forces us to specify -n (i.e. "regsvr32 /n /i").
* Without -n, DllRegisterServer called before DllInstall would mistakenly
* overwrite the default "PostgreSQL" event source registration.
*/
if (bInstall)
DllRegisterServer();
return S_OK;
}
示例15: DllInstall
STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCmdLine)
{
HRESULT hr = E_FAIL;
static const wchar_t szUserSwitch[] = L"user";
if ( pszCmdLine != NULL )
{
#if defined(_MSC_VER) && (_MSC_VER >= 1500) // No VS2005
if ( _wcsnicmp(pszCmdLine, szUserSwitch, _countof(szUserSwitch)) == 0 )
AtlSetPerUserRegistration(true);
#endif
}
if ( bInstall )
{
hr = DllRegisterServer();
if ( FAILED(hr) )
DllUnregisterServer();
}
else
hr = DllUnregisterServer();
return hr;
}