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


C++ CComModule::RevokeClassObjects方法代码示例

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


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

示例1: WinMain


//.........这里部分代码省略.........
	free(szArglist);

    // load and register VP type library for COM integration
    char szFileName[_MAX_PATH];
    if (GetModuleFileName(hInstance, szFileName, _MAX_PATH))
    {
        ITypeLib *ptl = NULL;
        MAKE_WIDEPTR_FROMANSI(wszFileName, szFileName);
        if (SUCCEEDED(LoadTypeLib(wszFileName, &ptl)))
        {
            // first try to register system-wide (if running as admin)
            HRESULT hr = RegisterTypeLib(ptl, wszFileName, NULL);
            if (!SUCCEEDED(hr))
            {
                // if failed, register only for current user
                hr = RegisterTypeLibForUser(ptl, wszFileName, NULL);
                if (!SUCCEEDED(hr))
                    MessageBox(0, "Could not register type library. Try running Visual Pinball as administrator.", "Error", MB_ICONWARNING);
            }
            ptl->Release();
        }
        else
            MessageBox(0, "Could not load type library.", "Error", MB_ICONSTOP);
    }

    if (bRun)
    {
#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));

		INITCOMMONCONTROLSEX iccex;
		iccex.dwSize = sizeof(INITCOMMONCONTROLSEX);
		iccex.dwICC = ICC_COOL_CLASSES;
		InitCommonControlsEx(&iccex);

        {
            EditableRegistry::RegisterEditable<Bumper>();
            EditableRegistry::RegisterEditable<Decal>();
            EditableRegistry::RegisterEditable<DispReel>();
            EditableRegistry::RegisterEditable<Flasher>();
            EditableRegistry::RegisterEditable<Flipper>();
            EditableRegistry::RegisterEditable<Gate>();
            EditableRegistry::RegisterEditable<Kicker>();
            EditableRegistry::RegisterEditable<Light>();
            EditableRegistry::RegisterEditable<LightSeq>();
            EditableRegistry::RegisterEditable<Plunger>();
            EditableRegistry::RegisterEditable<Primitive>();
            EditableRegistry::RegisterEditable<Ramp>();
            EditableRegistry::RegisterEditable<Rubber>();
            EditableRegistry::RegisterEditable<Spinner>();
            EditableRegistry::RegisterEditable<Surface>();
            EditableRegistry::RegisterEditable<Textbox>();
            EditableRegistry::RegisterEditable<Timer>();
            EditableRegistry::RegisterEditable<Trigger>();
        }

		g_pvp = new VPinball();
		g_pvp->AddRef();
		g_pvp->Init();
		g_haccel = LoadAccelerators(g_hinst,MAKEINTRESOURCE(IDR_VPACCEL));

		if (fFile)
			{
			g_pvp->LoadFileName(szTableFileName);

			if (fPlay)
				g_pvp->DoPlay();
			}

		// VBA APC handles message loop (bastards)
		g_pvp->MainMsgLoop();

		g_pvp->Release();

		DestroyAcceleratorTable(g_haccel);

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

    _Module.Term();
    CoUninitialize();
#ifdef _CRTDBG_MAP_ALLOC
#ifdef DEBUG_XXX  //disable this in perference to DevPartner
	_CrtSetDumpClient(MemLeakAlert);
#endif
	_CrtDumpMemoryLeaks();
#endif
	//SET_CRT_DEBUG_FIELD( _CRTDBG_LEAK_CHECK_DF );

    return nRet;
}
开发者ID:paulftw,项目名称:vpinball,代码行数:101,代码来源:main.cpp

示例2: mainOPCThread


//.........这里部分代码省略.........
				{ // shutdown event
					OPCShutdownRequest *sreq; 

					_TRACE(TL_DEB, TG_ENG, (_T("received shutdown event")));
					while(!m_shutdownList.IsEmpty())
					{
						sreq = m_shutdownList.RemoveHead();
						if (sreq->server)
						{
							sreq->server->sendShutdownRequest(sreq->reason);
							if (sreq->event != INVALID_HANDLE_VALUE)
								::SetEvent(sreq->event);	
							sreq->server->release();
						}
						delete sreq;
					}
				} 
				break;

				default:
				{ // timeout
					//-- check client connections --
					GenericList<GenericBranch> serverListCopy;
					POSITION posSrv;
					GenericServer *server;	
					BOOL conOK;

					serverListCopy.create();

					{
				 	GenericList<GenericBranch> serverList(m_opcRoot->getBranchList());
					posSrv = serverList.getStartPosition();
					while(posSrv)
					{
						server = (GenericServer *)serverList.getNext(posSrv);
						server->addRef();
						serverListCopy.add(server);
					}
					}

					posSrv = serverListCopy.getStartPosition();
					while(posSrv)
					{
						server = (GenericServer *)serverListCopy.getNext(posSrv);

						conOK = server->checkClientConnection();
							
						if (!conOK)
						{
							server->disconnectClient();
						}
						server->release();
					}

					serverListCopy.free();
				}
				break;
			}
		}

		//-- terminated engine --
		if (m_type == OutProc)
		{
			_TRACE(TL_DEB, TG_ENG, (_T("revoke class objects")));
			_Module.RevokeClassObjects(); 
		}

		//-- disconnect all clients --
	 	GenericList<GenericBranch> serverList(m_opcRoot->getBranchList());
		POSITION posSrv;
		GenericServer *server;	
		posSrv = serverList.getStartPosition();
		while(posSrv)
		{
			server = (GenericServer *)serverList.getNext(posSrv);
			server->disconnectClient();
		}
		serverList.unlock();

		_TRACE(TL_DEB, TG_ENG, (_T("COM uninitialize")));
		::CoUninitialize();
		_TRACE(TL_INF, TG_ENG, (_T("terminated engine thread")));

	}
	catch(CException* e)
	{
		TCHAR excText[100];
		CRuntimeClass* rt = e->GetRuntimeClass();
		e->GetErrorMessage(excText, 100);
		_ERROR(TG_ENG, OPCENGINE_ERR_EXCEPTION,(_T("MFC EXCEPTION in OPC Engine Main Thread: %s (%s)"), rt->m_lpszClassName, excText));
		return 1;
	}	
	catch(...)
	{
		_ERROR(TG_ENG, OPCENGINE_ERR_EXCEPTION,(_T("EXCEPTION in OPC Engine Main Thread")));
		return 1;
	}	

    return S_OK;
}
开发者ID:LM25TTD,项目名称:ATCMcontrol_Engineering,代码行数:101,代码来源:OPCEngine.cpp

示例3: Run

   virtual int Run()
   {
      if (bRun)
      {
#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));

         INITCOMMONCONTROLSEX iccex;
         iccex.dwSize = sizeof(INITCOMMONCONTROLSEX);
         iccex.dwICC = ICC_COOL_CLASSES;
         InitCommonControlsEx(&iccex);

         {
            EditableRegistry::RegisterEditable<Bumper>();
            EditableRegistry::RegisterEditable<Decal>();
            EditableRegistry::RegisterEditable<DispReel>();
            EditableRegistry::RegisterEditable<Flasher>();
            EditableRegistry::RegisterEditable<Flipper>();
            EditableRegistry::RegisterEditable<Gate>();
            EditableRegistry::RegisterEditable<Kicker>();
            EditableRegistry::RegisterEditable<Light>();
            EditableRegistry::RegisterEditable<LightSeq>();
            EditableRegistry::RegisterEditable<Plunger>();
            EditableRegistry::RegisterEditable<Primitive>();
            EditableRegistry::RegisterEditable<Ramp>();
            EditableRegistry::RegisterEditable<Rubber>();
            EditableRegistry::RegisterEditable<Spinner>();
            EditableRegistry::RegisterEditable<Surface>();
            EditableRegistry::RegisterEditable<Textbox>();
            EditableRegistry::RegisterEditable<Timer>();
            EditableRegistry::RegisterEditable<Trigger>();
            EditableRegistry::RegisterEditable<HitTarget>();
         }

         g_pvp = new VPinball();
         g_pvp->AddRef();
         g_pvp->Init();
         g_haccel = LoadAccelerators(g_hinst, MAKEINTRESOURCE(IDR_VPACCEL));

         if (fFile)
         {
            bool lf = true;
            if (szTableFileName[0] != '\0')
               g_pvp->LoadFileName(szTableFileName);
            else
               lf = g_pvp->LoadFile();

            if (fPlay && lf)
               g_pvp->DoPlay();

			if (fPov && lf)
			   g_pvp->Quit();
         }

         // VBA APC handles message loop (bastards)
         g_pvp->MainMsgLoop();

         g_pvp->Release();

         DestroyAcceleratorTable(g_haccel);

         _Module.RevokeClassObjects();
         Sleep(THREADS_PAUSE); //wait for any threads to finish
      }
      return 0;
   }
开发者ID:djrobx,项目名称:vpinballx,代码行数:74,代码来源:main.cpp

示例4: revokeClassObjects

HRESULT OPCEngine::revokeClassObjects(void)
{
	return _Module.RevokeClassObjects(); 
}
开发者ID:LM25TTD,项目名称:ATCMcontrol_Engineering,代码行数:4,代码来源:OPCEngine.cpp


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