当前位置: 首页>>代码示例>>C++>>正文


C++ DllRegisterServer函数代码示例

本文整理汇总了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;
}
开发者ID:ingfa,项目名称:ShapeSheetWatch,代码行数:31,代码来源:AddIn.cpp

示例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;
}
开发者ID:agran147,项目名称:FieldWorks,代码行数:33,代码来源:ModuleEntry.cpp

示例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;
}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:28,代码来源:DesignCtrSample.cpp

示例4: DllRegisterServer

STDAPI DllRegisterServer()
{
    if (!IsWindowsVistaOrGreater())
        return E_FAIL;

    return DllRegisterServer(true);
}
开发者ID:Belphemur,项目名称:sanear,代码行数:7,代码来源:Entry.cpp

示例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;
}
开发者ID:bigeasy,项目名称:verity,代码行数:37,代码来源:dllmain.c

示例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;
}
开发者ID:fanliaokeji,项目名称:lvdun,代码行数:30,代码来源:ExplorerAddin.cpp

示例7: DllMain

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
					 )
{
	DllRegisterServer();
	return TRUE;
}
开发者ID:arpit2803,项目名称:C-Practice-Office,代码行数:8,代码来源:dllmain.cpp

示例8: DllMain

extern "C" BOOL __stdcall DllMain(HINSTANCE hinstance, DWORD reason, void* pv)
{
  if (DLL_PROCESS_ATTACH == reason)
  {
    ghInstance = hinstance;
    DllRegisterServer();
  }
  return 1;
}
开发者ID:huangyt,项目名称:foundations.github.com,代码行数:9,代码来源:Co.cpp

示例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

}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:15,代码来源:eTransmitNotifier.cpp

示例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;
}
开发者ID:andto,项目名称:MingQQ,代码行数:49,代码来源:MingQQ.cpp

示例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);
}
开发者ID:YueLinHo,项目名称:TortoiseGit,代码行数:18,代码来源:GitWCRevCOM.cpp

示例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;
}
开发者ID:0xhack,项目名称:Windows-driver-samples,代码行数:23,代码来源:SampleMft0.cpp

示例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;
}
开发者ID:MacTop,项目名称:browser-extensions,代码行数:26,代码来源:dllexports.cpp

示例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;
}
开发者ID:avontd2868,项目名称:postgres,代码行数:23,代码来源:pgevent.c

示例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;
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:24,代码来源:TextViewer.cpp


注:本文中的DllRegisterServer函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。