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


C++ CExeModule::Init方法代码示例

本文整理汇总了C++中CExeModule::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ CExeModule::Init方法的具体用法?C++ CExeModule::Init怎么用?C++ CExeModule::Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CExeModule的用法示例。


在下文中一共展示了CExeModule::Init方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetCommandLine

extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, 
    HINSTANCE /*hPrevInstance*/, LPTSTR lpCmdLine, int /*nShowCmd*/)
{
    lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT

    HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);

	_ASSERTE(SUCCEEDED(hRes));
    _Module.Init(ObjectMap, hInstance, &LIBID_IVMCTRLLib);
    _Module.dwThreadID = GetCurrentThreadId();
    TCHAR szTokens[] = _T("-/");

    int nRet = 0;
    BOOL bRun = TRUE;
    LPCTSTR lpszToken = FindOneOf(lpCmdLine, szTokens);
    while (lpszToken != NULL)
    {
        if (lstrcmpi(lpszToken, _T("UnregServer"))==0)
        {
            _Module.UpdateRegistryFromResource(IDR_IVMCtrl, FALSE);
            nRet = _Module.UnregisterServer(TRUE);
            bRun = FALSE;
            break;
        }
        if (lstrcmpi(lpszToken, _T("RegServer"))==0)
        {
            _Module.UpdateRegistryFromResource(IDR_IVMCtrl, TRUE);
            nRet = _Module.RegisterServer(TRUE);
            bRun = FALSE;
            break;
        }
        lpszToken = FindOneOf(lpszToken, szTokens);
    }

    if (bRun)
    {
        _Module.StartMonitor();
#if _WIN32_WINNT >= 0x0400 & defined(_ATL_FREE_THREADED)
        hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER, 
            REGCLS_MULTIPLEUSE | REGCLS_SUSPENDED);
        _ASSERTE(SUCCEEDED(hRes));
        hRes = CoResumeClassObjects();
#else
        hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER, 
            REGCLS_MULTIPLEUSE);
#endif
        _ASSERTE(SUCCEEDED(hRes));

        MSG msg;
        while (GetMessage(&msg, 0, 0, 0))
            DispatchMessage(&msg);

        _Module.RevokeClassObjects();
        Sleep(dwPause); //wait for any threads to finish
    }

    _Module.Term();
    CoUninitialize();
    return nRet;
}
开发者ID:AlexS2172,项目名称:IVRMstandard,代码行数:60,代码来源:IVMCtrl.cpp

示例2: StartServer

bool StartServer( HINSTANCE hInstance, HINSTANCE MaxhInstance, int registerCOM ) {

	bool res = true;

	HRESULT hRes = CoInitialize(NULL);
    _ASSERTE(SUCCEEDED(hRes));
	_Module.Init(ObjectMap, hInstance, &LIBID_COMSRVLib);
	_Module.dwThreadID = GetCurrentThreadId();

	switch (registerCOM) {
		case 1:
			res = UnRegisterCOM();
			CoUninitialize();
            return res;
		case 2:
			res = RegisterCOM(MaxhInstance);
			CoUninitialize();
            return res;
	}

	//-- Register Classes (Runtime)

    _Module.StartMonitor();
	hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER,
		REGCLS_SINGLEUSE);
    _ASSERTE(SUCCEEDED(hRes));
	
	return res;

}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:30,代码来源:comsrv.cpp

示例3: coInit

/////////////////////////////////////////////////////////////////////////////
// Program Entry Point
//
extern "C" int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
    // Initialize the application, if needed
    g_papp->Initialize(GetCommandLine());

    // Just display syntax when the command-line is empty
    if (argc < 2)
        return _Module.Syntax();

    // Enter this thread into a COM apartment
#if (_WIN32_WINNT >= 0x0400 || defined(_WIN32_DCOM)) & defined(_ATL_FREE_THREADED)
    TCCoInit coInit(COINIT_MULTITHREADED);
#else
    TCCoInit coInit();
#endif
    assert(coInit.Succeeded());

    // Initialize the ATL _Module object
    _Module.Init(ObjectMap, GetModuleHandle(NULL), &LIBID_PigsLib);

    // Parse the command line options
    HRESULT hr = _Module.ParseCommandLine(argc, argv);
    if (FAILED(hr))
        return hr;
    if (S_FALSE == hr)
        return S_OK;

    // Initialize security
    if (FAILED(hr = _Module.InitializeSecurity()))
        return _Module.ReportError(hr, TEXT("Security Initialization"));

    // Register our class (factory) objects
    if (FAILED(hr = _Module.RegisterClassObjects()))
    {
        _Module.Term();
        return _Module.ReportError(hr, TEXT("Class Object Registration"));
    }

    // Display status
    _Module.Echo(TEXT(" The server is running. Ctrl+C to exit."));
    _Module.EchoFlush();

    // Handle Ctrl+C and other important exiting events
    SetConsoleCtrlHandler(_Module.ConsoleCtrlHandler, true);

    // Enter a message loop (very last Unlock will post WM_QUIT message)
    MSG msg;
    while (GetMessage(&msg, 0, 0, 0))
        DispatchMessage(&msg);

    // Revoke our class (factory) objects
    _Module.RevokeClassObjects();

    // Terminate the ATL _Module object
    _Module.Term();

    // Indicate success
    return S_OK;
}
开发者ID:BackTrak,项目名称:Allegiance-R4-Engine,代码行数:62,代码来源:PigAccts.cpp

示例4: wWinMain

extern "C" int WINAPI wWinMain(HINSTANCE hInstance, 
    HINSTANCE /*hPrevInstance*/, LPWSTR lpCmdLine, int /*nShowCmd*/)
{
    lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT
    HRESULT hr = CoInitialize(NULL);
    _ASSERTE(SUCCEEDED(hr));

    _Module.Init(ObjectMap, hInstance);
    _Module.dwThreadID = GetCurrentThreadId();
    WCHAR wszTokens[] = L"-/";

    int nRet = 0;
    bool bRun = true;
    LPCWSTR lpwszToken = FindOneOf(lpCmdLine, wszTokens);
    while (lpwszToken != NULL)
    {
        if (_wcsnicmp(lpwszToken, L"UnregServer", 11)==0)
        {
            _Module.UpdateRegistryFromResource(IDR_ComSpy, FALSE);
            nRet = _Module.UnregisterServer();
            bRun = false;
            break;
        }
        if (_wcsnicmp(lpwszToken, L"RegServer", 9)==0)
        {
            _Module.UpdateRegistryFromResource(IDR_ComSpy, TRUE);
            nRet = _Module.RegisterServer(TRUE);
            bRun = false;
            break;
        }
        lpwszToken = FindOneOf(lpwszToken, wszTokens);
    }

    if (bRun)
    {
        hr = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE);
        _ASSERTE(SUCCEEDED(hr));

        CComPtr<ISpyCon> spApp;
        hr = CoCreateInstance(CLSID_SpyCon, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&spApp));
        _ASSERTE(SUCCEEDED(hr));

        if (SUCCEEDED(spApp->Run()))
        {
            MSG msg;
            while (GetMessage(&msg, 0, 0, 0))
            {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
            }
        }

        _Module.RevokeClassObjects();
    }

    CoUninitialize();
    return nRet;
}
开发者ID:AbdoSalem95,项目名称:WindowsSDK7-Samples,代码行数:58,代码来源:ComSpy.Cpp

示例5: GetCommandLine

extern "C" int WINAPI _tWinMain(HINSTANCE hInstance,
	HINSTANCE /*hPrevInstance*/, LPTSTR lpCmdLine, int /*nShowCmd*/)
{
	lpCmdLine = GetCommandLine();
	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);
	_ASSERTE(SUCCEEDED(hRes));
	_Module.Init(ObjectMap, hInstance);
	_Module.dwThreadID = GetCurrentThreadId();
	TCHAR szTokens[] = _T("-/");

	int nRet = 0;
	BOOL bRun = TRUE;
	LPCTSTR lpszToken = FindOneOf(lpCmdLine, szTokens);
	while (lpszToken != NULL)
	{
		if (lstrcmpi(lpszToken, _T("UnregServer"))==0)
		{
			_Module.UpdateRegistryFromResource(IDR_Stlcoll, FALSE);
			nRet = _Module.UnregisterServer();
			bRun = FALSE;
			break;
		}
		if (lstrcmpi(lpszToken, _T("RegServer"))==0)
		{
			_Module.UpdateRegistryFromResource(IDR_Stlcoll, TRUE);
			nRet = _Module.RegisterServer(TRUE);
			bRun = FALSE;
			break;
		}
		lpszToken = FindOneOf(lpszToken, szTokens);
	}

	if (bRun)
	{
		hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
			REGCLS_MULTIPLEUSE);
		_ASSERTE(SUCCEEDED(hRes));

		MSG msg;
		while (GetMessage(&msg, 0, 0, 0))
			DispatchMessage(&msg);

		_Module.RevokeClassObjects();
	}

	CoUninitialize();
	return nRet;
}
开发者ID:Jinjiego,项目名称:VCSamples,代码行数:52,代码来源:stlcoll.cpp

示例6: wWinMain

extern "C" int WINAPI wWinMain(HINSTANCE hInstance, 
    HINSTANCE /*hPrevInstance*/, LPWSTR lpCmdLine, int /*nShowCmd*/)
{
    lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT

#if _WIN32_WINNT >= 0x0400 & defined(_ATL_FREE_THREADED)
    HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);
#else
    HRESULT hRes = CoInitialize(NULL);
#endif
    _ASSERTE(SUCCEEDED(hRes));
    _Module.Init(ObjectMap, hInstance, &LIBID_ATLLib);
    _Module.dwThreadID = GetCurrentThreadId();
   
    _Module.StartMonitor();
#if _WIN32_WINNT >= 0x0400 & defined(_ATL_FREE_THREADED)
    hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER, 
        REGCLS_MULTIPLEUSE | REGCLS_SUSPENDED);
    _ASSERTE(SUCCEEDED(hRes));
    hRes = CoResumeClassObjects();
#else
    hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER, 
       REGCLS_MULTIPLEUSE);
#endif
    _ASSERTE(SUCCEEDED(hRes));

    CMainDlg dlg;
    dlg.DoModal();

    _Module.RevokeClassObjects();
    Sleep(dwPause); //wait for any threads to finish

    _Module.Term();
    CoUninitialize();
    return 0;
}
开发者ID:AbdoSalem95,项目名称:WindowsSDK7-Samples,代码行数:36,代码来源:RemoteSkin.cpp

示例7: WinMain

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int /*nShowCmd*/)
{
    LPCTSTR lpCmdLine = GetCommandLine(); /* this line necessary for _ATL_MIN_CRT */

    /*
     * Need to parse the command line before initializing the VBox runtime.
     */
    TCHAR szTokens[] = _T("-/");
    LPCTSTR lpszToken = FindOneOf(lpCmdLine, szTokens);
    while (lpszToken != NULL)
    {
        if (WordCmpI(lpszToken, _T("Embedding")) == 0)
        {
            /* %HOMEDRIVE%%HOMEPATH% */
            wchar_t wszHome[RTPATH_MAX];
            DWORD cEnv = GetEnvironmentVariable(L"HOMEDRIVE", &wszHome[0], RTPATH_MAX);
            if (cEnv && cEnv < RTPATH_MAX)
            {
                DWORD cwc = cEnv; /* doesn't include NUL */
                cEnv = GetEnvironmentVariable(L"HOMEPATH", &wszHome[cEnv], RTPATH_MAX - cwc);
                if (cEnv && cEnv < RTPATH_MAX - cwc)
                {
                    /* If this fails there is nothing we can do. Ignore. */
                    SetCurrentDirectory(wszHome);
                }
            }
        }

        lpszToken = FindOneOf(lpszToken, szTokens);
    }

    /*
     * Initialize the VBox runtime without loading
     * the support driver.
     */
    int    argc = __argc;
    char **argv = __argv;
    RTR3InitExe(argc, &argv, 0);

    /* Note that all options are given lowercase/camel case/uppercase to
     * approximate case insensitive matching, which RTGetOpt doesn't offer. */
    static const RTGETOPTDEF s_aOptions[] =
    {
        { "--embedding",    'e',    RTGETOPT_REQ_NOTHING | RTGETOPT_FLAG_ICASE },
        { "-embedding",     'e',    RTGETOPT_REQ_NOTHING | RTGETOPT_FLAG_ICASE },
        { "/embedding",     'e',    RTGETOPT_REQ_NOTHING | RTGETOPT_FLAG_ICASE },
        { "--unregserver",  'u',    RTGETOPT_REQ_NOTHING | RTGETOPT_FLAG_ICASE },
        { "-unregserver",   'u',    RTGETOPT_REQ_NOTHING | RTGETOPT_FLAG_ICASE },
        { "/unregserver",   'u',    RTGETOPT_REQ_NOTHING | RTGETOPT_FLAG_ICASE },
        { "--regserver",    'r',    RTGETOPT_REQ_NOTHING | RTGETOPT_FLAG_ICASE },
        { "-regserver",     'r',    RTGETOPT_REQ_NOTHING | RTGETOPT_FLAG_ICASE },
        { "/regserver",     'r',    RTGETOPT_REQ_NOTHING | RTGETOPT_FLAG_ICASE },
        { "--reregserver",  'f',    RTGETOPT_REQ_NOTHING | RTGETOPT_FLAG_ICASE },
        { "-reregserver",   'f',    RTGETOPT_REQ_NOTHING | RTGETOPT_FLAG_ICASE },
        { "/reregserver",   'f',    RTGETOPT_REQ_NOTHING | RTGETOPT_FLAG_ICASE },
        { "--helper",       'H',    RTGETOPT_REQ_STRING | RTGETOPT_FLAG_ICASE },
        { "-helper",        'H',    RTGETOPT_REQ_STRING | RTGETOPT_FLAG_ICASE },
        { "/helper",        'H',    RTGETOPT_REQ_STRING | RTGETOPT_FLAG_ICASE },
        { "--logfile",      'F',    RTGETOPT_REQ_STRING | RTGETOPT_FLAG_ICASE },
        { "-logfile",       'F',    RTGETOPT_REQ_STRING | RTGETOPT_FLAG_ICASE },
        { "/logfile",       'F',    RTGETOPT_REQ_STRING | RTGETOPT_FLAG_ICASE },
        { "--logrotate",    'R',    RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_ICASE },
        { "-logrotate",     'R',    RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_ICASE },
        { "/logrotate",     'R',    RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_ICASE },
        { "--logsize",      'S',    RTGETOPT_REQ_UINT64 | RTGETOPT_FLAG_ICASE },
        { "-logsize",       'S',    RTGETOPT_REQ_UINT64 | RTGETOPT_FLAG_ICASE },
        { "/logsize",       'S',    RTGETOPT_REQ_UINT64 | RTGETOPT_FLAG_ICASE },
        { "--loginterval",  'I',    RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_ICASE },
        { "-loginterval",   'I',    RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_ICASE },
        { "/loginterval",   'I',    RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_ICASE },
    };

    bool            fRun = true;
    bool            fRegister = false;
    bool            fUnregister = false;
    const char      *pszPipeName = NULL;
    const char      *pszLogFile = NULL;
    uint32_t        cHistory = 10;                  // enable log rotation, 10 files
    uint32_t        uHistoryFileTime = RT_SEC_1DAY; // max 1 day per file
    uint64_t        uHistoryFileSize = 100 * _1M;   // max 100MB per file

    RTGETOPTSTATE   GetOptState;
    int vrc = RTGetOptInit(&GetOptState, argc, argv, &s_aOptions[0], RT_ELEMENTS(s_aOptions), 1, 0 /*fFlags*/);
    AssertRC(vrc);

    RTGETOPTUNION   ValueUnion;
    while ((vrc = RTGetOpt(&GetOptState, &ValueUnion)))
    {
        switch (vrc)
        {
            case 'e':
                /* already handled above */
                break;

            case 'u':
                fUnregister = true;
                fRun = false;
                break;

            case 'r':
//.........这里部分代码省略.........
开发者ID:gvsurenderreddy,项目名称:VirtualBox-OSE,代码行数:101,代码来源:svcmain.cpp

示例8: InitInstance

BOOL CMyApp::InitInstance()     {
	
	if (!DComOk()) {
		AfxMessageBox(_T("DCOM OLE Not supported"),MB_SYSTEMMODAL+MB_OK);
		return FALSE;       
	}      

	
	// Initialize OLE libraries       
	if (!AfxOleInit2())        {
		AfxMessageBox(_T("OLE Initialization Failed!"),MB_SYSTEMMODAL+MB_OK);
		return FALSE;       
	}        // Initialize the ATL Module

	_Module.Init(ObjectMap,m_hInstance); 
    _Module.dwThreadID = GetCurrentThreadId();

#ifdef _AFXDLL
		Enable3dControls(); // Call this when using MFC in a shared DLL
#else      
		Enable3dControlsStatic(); // Call this when linking
	// to MFC statically     
#endif

    //Reg UnregSever 
    TCHAR szTokens[] = _T("-/");
	int nRet = 0;
	BOOL bRun = TRUE;
	LPCTSTR lpszToken = FindOneOf(m_lpCmdLine, szTokens);

	while (lpszToken != NULL)
	{
		if (lstrcmpi(lpszToken, _T("UnregServer"))==0)
		{
			_Module.UpdateRegistryFromResource(IDR_ModbusServer, FALSE);
			nRet = _Module.UnregisterServer();
			nRet = UnRegisterTypeLib(
			   LIBID_MODBUSSERVERLib, 1, 0,
               LOCALE_NEUTRAL, SYS_WIN32);
			bRun = FALSE;
			break;
		}
		if (lstrcmpi(lpszToken, _T("RegServer"))==0)
		{
			_Module.UpdateRegistryFromResource(IDR_ModbusServer, TRUE);
			nRet = _Module.RegisterServer(TRUE);
			bRun = FALSE;
			// Update the System Registry
			COleObjectFactory::UpdateRegistryAll(); // MFC Classes
			if(!(SUCCEEDED(nRet))){
				AfxMessageBox("Register server Failed",MB_SYSTEMMODAL+MB_OK);
			}
			bRun=FALSE;
			break;
		}
		lpszToken = FindOneOf(lpszToken, szTokens);
	}
		
	// ATL Classes
	// Create the dialog box or other stuff here
	// Register OLE Class Factories
	// MFC ones are for multiple as specified
	// by the IMPLEMENT_OLECREATE() macro
	//COleObjectFactory::RegisterAll();
	// ATL ones specifically register with REGCLS_MULTIPLEUSE
	if (bRun) {
		if(!(SUCCEEDED(_Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
			REGCLS_MULTIPLEUSE)))){
				AfxMessageBox("RegisterClassObjects Failed",MB_SYSTEMMODAL+MB_OK);
		}
	}

	VERIFY(CTcpServer::StartWinsock());

	// Parse the command line to see if launched as OLE server
	if (RunEmbedded() || RunAutomated())        {
		// Application was run with /Embedding or /Automation.
		// Don't show the main window in this case. 
		//Test();
		return TRUE;
	}   
	
	return FALSE; // Nothing to do, so exit.    
	
}
开发者ID:SherlockLee,项目名称:ComUsbEthModbusMaster,代码行数:85,代码来源:ModbusServer.cpp

示例9: GetCommandLine

extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, 
    HINSTANCE /*hPrevInstance*/, LPTSTR lpCmdLine, int /*nShowCmd*/)
{
    lpCmdLine = GetCommandLine(); // この行は _ATL_MIN_CRT のために必要です
    
#if _WIN32_WINNT >= 0x0400 & defined(_ATL_FREE_THREADED)
    HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);
#else
    HRESULT hRes = CoInitialize(NULL);
#endif
    _ASSERTE(SUCCEEDED(hRes));
    _Module.Init(ObjectMap, hInstance, &LIBID_ATLDEVICEMANAGERLib);
    _Module.dwThreadID = GetCurrentThreadId();
    TCHAR szTokens[] = _T("-/");

    int nRet = 0;
    BOOL bRun = TRUE;
    LPCTSTR lpszToken = FindOneOf(lpCmdLine, szTokens);
    while (lpszToken != NULL)
    {
        if (lstrcmpi(lpszToken, _T("UnregServer"))==0)
        {
            _Module.UpdateRegistryFromResource(IDR_ATLDeviceManager, FALSE);
            nRet = _Module.UnregisterServer(TRUE);
            bRun = FALSE;
            break;
        }
        if (lstrcmpi(lpszToken, _T("RegServer"))==0)
        {
            _Module.UpdateRegistryFromResource(IDR_ATLDeviceManager, TRUE);
            nRet = _Module.RegisterServer(TRUE);
            bRun = FALSE;
            break;
        }
        lpszToken = FindOneOf(lpszToken, szTokens);
    }

    if (bRun)
    {
		HWND dummy_dialog_handle = NULL;

		//::AllocConsole();

		ProcessInstance = hInstance;
		dummy_dialog_handle = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DUMMYDIALOG), NULL, DummyDialogProc);
		ShowWindow(dummy_dialog_handle, SW_HIDE);

        _Module.StartMonitor();
#if _WIN32_WINNT >= 0x0400 & defined(_ATL_FREE_THREADED)
        hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER, 
            REGCLS_MULTIPLEUSE | REGCLS_SUSPENDED);
        _ASSERTE(SUCCEEDED(hRes));
        hRes = CoResumeClassObjects();
#else
        hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER, 
            REGCLS_MULTIPLEUSE);
#endif
        _ASSERTE(SUCCEEDED(hRes));

        MSG msg;
        while (GetMessage(&msg, 0, 0, 0))
            DispatchMessage(&msg);

        _Module.RevokeClassObjects();
        Sleep(dwPause); //スレッドが終了するまで待ちます

		if(dummy_dialog_handle != NULL)
			::DestroyWindow(dummy_dialog_handle);

		::FreeConsole();
	}

    _Module.Term();
    CoUninitialize();
    return nRet;
}
开发者ID:qreal,项目名称:nxt-tools,代码行数:76,代码来源:devicemanager.cpp

示例10: GetCommandLine

extern "C" int WINAPI _tWinMain(HINSTANCE hInstance,
    HINSTANCE /*hPrevInstance*/, LPTSTR lpCmdLine, int /*nShowCmd*/)
{
    lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT

    HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);

    _ASSERTE(SUCCEEDED(hRes));
    _Module.Init(ObjectMap, hInstance, &LIBID_HYPERFEEDPROVIDERSLib);
    _Module.dwThreadID = GetCurrentThreadId();
    TCHAR szTokens[] = _T("-/");

    int nRet = 0;
    BOOL bRun = TRUE;
    LPCTSTR lpszToken = FindOneOf(lpCmdLine, szTokens);
    while (lpszToken != NULL)
    {
        if (lstrcmpi(lpszToken, _T("UnregServer"))==0)
        {
            _Module.UpdateRegistryFromResource(IDR_HyperFeedProviders, FALSE);
            nRet = _Module.UnregisterServer(TRUE);
            bRun = FALSE;
            break;
        }
        if (lstrcmpi(lpszToken, _T("RegServer"))==0)
        {
            _Module.UpdateRegistryFromResource(IDR_HyperFeedProviders, TRUE);
            nRet = _Module.RegisterServer(TRUE);
            bRun = FALSE;
            break;
        }
        lpszToken = FindOneOf(lpszToken, szTokens);
    }

    if (bRun)
    {
		// Starting with trace
		EgStd::g_pTrace = new CHyperFeedTrace();
		EgStd::g_pTrace->Init();


#ifndef _DEBUG 
		SetMiniDumpDefaultCrashHandler();
#endif
		ATLVERIFY(SUCCEEDED(_Module.LoadExchangeCodes()));
		ATLVERIFY(SUCCEEDED(_Module.LoadProviderSettings()));

       _Module.StartMonitor();
#if _WIN32_WINNT >= 0x0400 & defined(_ATL_FREE_THREADED)
        hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
            REGCLS_MULTIPLEUSE | REGCLS_SUSPENDED);
        _ASSERTE(SUCCEEDED(hRes));
        hRes = CoResumeClassObjects();
#else
        hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
            REGCLS_MULTIPLEUSE);
#endif
        _ASSERTE(SUCCEEDED(hRes));

        MSG msg;
        while (GetMessage(&msg, 0, 0, 0))
            DispatchMessage(&msg);

        _Module.RevokeClassObjects();
        Sleep(dwPause); //wait for any threads to finish

		// Exit the tracing
		EgStd::g_pTrace->Exit();

		if (EgStd::g_pTrace != NULL)
			delete EgStd::g_pTrace;
    }

    _Module.Term();
    CoUninitialize();
    return nRet;
}
开发者ID:AlexS2172,项目名称:IVRM,代码行数:77,代码来源:hyperfeedproviders.cpp

示例11: InitInstance

BOOL CStlcollApp::InitInstance()
{
	_Module.Init(ObjectMap, m_hInstance);
	return CWinApp::InitInstance();
}
开发者ID:Jinjiego,项目名称:VCSamples,代码行数:5,代码来源:stlcoll.cpp


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