⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cli-apt.cpp

📁 inside com的源代码
💻 CPP
字号:
#include <windows.h> 
#include <stdlib.h>
#include <objbase.h>
#include <assert.h>

#include "Iface.h"
#include "Apart.h"
#include "Cli-Apt.h"

///////////////////////////////////////////////////////////
//
// Constructor
//
CClientApartment::CClientApartment() 
{
	m_pIX = NULL ;
} 

///////////////////////////////////////////////////////////
//
// Destructor
//
CClientApartment::~CClientApartment()
{
	if (m_pIX != NULL)
	{
		m_pIX->Release() ;
	}
}


///////////////////////////////////////////////////////////
//
// CreateTheComponent
//
HRESULT CClientApartment::CreateComponentOnThread(const CLSID& clsid,
                                                  const IID& iid,
                                                  IUnknown** ppI) 
{
	HRESULT hr = ::CoCreateInstance(clsid,
	                                NULL, 
	                                CLSCTX_INPROC_SERVER, 
	                                iid, 
	                                (void**)ppI) ;
	if (SUCCEEDED(hr))
	{
		// Query for the IX interface to use in WorkerFunction.
		hr = (*ppI)->QueryInterface(IID_IX, (void**)&m_pIX) ;
		if (FAILED(hr))
		{
			// If we can't use it, don't let anybody use it.
			(*ppI)->Release() ;
			return E_FAIL ;
		}
		
	}
	
	return hr ;
}

///////////////////////////////////////////////////////////
//
// WorkerFunction - This function is called by the worker thread.
//
void CClientApartment::WorkerFunction()
{
	if (m_pIX)
	{
		m_pIX->Tick() ;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -