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


C++ CExeModule类代码示例

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


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

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

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

示例3: RegisterCOM

bool RegisterCOM(HINSTANCE MaxhInstance) {
	
	_Module.UpdateRegistryFromResource(IDR_Comsrv, TRUE);
	HRESULT hRes = _Module.RegisterServer(TRUE);
    _ASSERTE(SUCCEEDED(hRes));
	
	//-- Update Server Location

	TCHAR szModule[_MAX_PATH];
	GetModuleFileName(MaxhInstance,szModule,_MAX_PATH);
	TCHAR szKeyName[256];
	TCHAR keyLocalServer[] = {_T("LocalServer32")};
	
	//-- MaxRenderer Class
	// DC 707698 - VISTA compatibility
	// this key needs to be created at install time
	TCHAR clsidApp[] = {_T("{4AD72E6E-5A4B-11D2-91CB-0060081C257E}")};
	_stprintf(szKeyName,_T("CLSID\\%s\\%s"),clsidApp,keyLocalServer);
	OpenKeyAndSetValue(szKeyName,szModule);

	//-- MaxBitmapInfo Class
	// DC 707698 - VISTA compatibility
	// this key needs to be created at install time
	_tcscpy(clsidApp,_T("{D888A162-6543-11D2-91CC-0060081C257E}"));
	_stprintf(szKeyName,_T("CLSID\\%s\\%s"),clsidApp,keyLocalServer);
	OpenKeyAndSetValue(szKeyName,szModule);

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

示例4: StopServer

void StopServer( ) {
//    _Module.Unlock();
	_Module.RevokeClassObjects();
	Sleep(dwPause);
	_Module.Term();
	CoUninitialize();
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:7,代码来源:comsrv.cpp

示例5: RegisterCOM

bool RegisterCOM(HINSTANCE MaxhInstance) {
	
	_Module.UpdateRegistryFromResource(IDR_Comsrv, TRUE);
	HRESULT hRes = _Module.RegisterServer(TRUE);
    _ASSERTE(SUCCEEDED(hRes));
	
	//-- Update Server Location

	TCHAR szModule[_MAX_PATH];
	GetModuleFileName(MaxhInstance,szModule,_MAX_PATH);
	TCHAR szKeyName[256];
	TCHAR keyLocalServer[] = {"LocalServer32"};
	
	//-- MaxRenderer Class

	TCHAR clsidApp[] = {"{4AD72E6E-5A4B-11D2-91CB-0060081C257E}"};
	wsprintf(szKeyName,"CLSID\\%s\\%s",clsidApp,keyLocalServer);
	OpenKeyAndSetValue(szKeyName,szModule);

	//-- MaxBitmapInfo Class

	_tcscpy(clsidApp,_T("{D888A162-6543-11D2-91CC-0060081C257E}"));
	wsprintf(szKeyName,"CLSID\\%s\\%s",clsidApp,keyLocalServer);
	OpenKeyAndSetValue(szKeyName,szModule);

#ifdef RENDER_VER
	//Max application object
	_tcscpy(clsidApp,_T("{8A9DCB83-B385-41D0-B8E8-05A1AD47E72A}"));
	wsprintf(szKeyName,"CLSID\\%s\\%s",clsidApp,keyLocalServer);
	OpenKeyAndSetValue(szKeyName,szModule);

	//Max document object
	_tcscpy(clsidApp,_T("{F40F75D9-7384-44F1-8AC1-933D8CBEA728}"));
	wsprintf(szKeyName,"CLSID\\%s\\%s",clsidApp,keyLocalServer);
	OpenKeyAndSetValue(szKeyName,szModule);

	//TestMarshalSpeed class
	//To DO
	//remove this when testing complete
	_tcscpy(clsidApp,_T("{93B00F73-A90D-4A4B-9F4D-B7328892D624}"));
	wsprintf(szKeyName,"CLSID\\%s\\%s",clsidApp,keyLocalServer);
	OpenKeyAndSetValue(szKeyName,szModule);
#endif
	return true;

}
开发者ID:2asoft,项目名称:xray,代码行数:46,代码来源:comsrv.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
    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

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

示例8: ExitInstance

int CMyApp::ExitInstance()     {

	DWORD dwStart = ::GetTickCount();
	MSG message;

	do {
	if (::PeekMessage(&message, NULL, 0, 0, PM_REMOVE)) {
			::TranslateMessage(&message);
			::DispatchMessage(&message);
		}
	}while ((::GetTickCount()-dwStart)<3000);


	// MFC's class factories registration is
	// automatically revoked by MFC itself
	_Module.RevokeClassObjects(); // Revoke class factories for ATL
	_Module.Term();               // cleanup ATL Global Module
	
	
	
	VERIFY(CTcpServer::StopWinsock());

	return CWinApp::ExitInstance();  
}
开发者ID:SherlockLee,项目名称:ComUsbEthModbusMaster,代码行数:24,代码来源:ModbusServer.cpp

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

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

示例11: ExitInstance

int CStlcollApp::ExitInstance()
{
	_Module.Term();
	return CWinApp::ExitInstance();
}
开发者ID:Jinjiego,项目名称:VCSamples,代码行数:5,代码来源:stlcoll.cpp

示例12: DllCanUnloadNow

STDAPI DllCanUnloadNow(void)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	return (AfxDllCanUnloadNow()==S_OK && _Module.GetLockCount()==0) ? S_OK : S_FALSE;
}
开发者ID:Jinjiego,项目名称:VCSamples,代码行数:5,代码来源:stlcoll.cpp

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

示例14: InitInstance

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

示例15: _tmain

int _tmain(int argc, LPTSTR argv[])
{
    int nRet = 0;

    if (_Module.IsWorker())
    {
        MSG(0, _T("Greetings from Worker! [%i]\n\n"), _Module.InstanceCount());
    }
    else
    {
        // check for help request or errors..
        nRet = _Module.LoadPreferences(argc, argv);
        if (nRet == ERROR_SUCCESS)
        {
            _Module.BackupTaskState();

            PROCESS_INFORMATION pi = {0};

            do
            {
                if (!_Module.CreateWorkerProcess(pi)) { nRet = -1; break; }

            } while (!_Module.WatchWorkerProcess(pi));
        }

        return nRet;
    }

    try
    {
        nRet = _Module.LoadPreferences(argc, argv);
        if (nRet == ERROR_SUCCESS)
        {
            CWsaInitialize _;

            if (_Module.Connect() == ERROR_SUCCESS)
            {
                nRet = _Module.Run();
            }
            _Module.Disconnect();
#ifdef _DEBUG
            MSG(0, _T("[%i] worker bye... \n"), _Module.InstanceCount());
            ::Sleep(3000);
#endif
        }
    }
    catch (int e)
    {
        nRet = CLog::Error(_T("Server failed."), e);
    }
    catch (std::exception& e)
    {
        ERR(_T("Exception caught: %s\n"), (LPCTSTR)CString(e.what()));
    }
    catch (...)
    {
        ERR(_T("Exception caught: unspecified.\n"));
    }

    return nRet;
}
开发者ID:rightmark,项目名称:test-repo,代码行数:61,代码来源:wsserver.cpp


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