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


C++ CComVariant::Clear方法代码示例

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


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

示例1: InitializeCodecContextFromHaaliInfo

FFCodecContext InitializeCodecContextFromHaaliInfo(CComQIPtr<IPropertyBag> pBag) {
	CComVariant pV;
	if (FAILED(pBag->Read(L"Type", &pV, NULL)) && SUCCEEDED(pV.ChangeType(VT_UI4)))
		return FFCodecContext();

	unsigned int TT = pV.uintVal;

	FFCodecContext CodecContext(avcodec_alloc_context3(NULL), DeleteHaaliCodecContext);

	unsigned int FourCC = 0;
	if (TT == TT_VIDEO) {
		pV.Clear();
		if (SUCCEEDED(pBag->Read(L"Video.PixelWidth", &pV, NULL)) && SUCCEEDED(pV.ChangeType(VT_UI4)))
			CodecContext->coded_width = pV.uintVal;

		pV.Clear();
		if (SUCCEEDED(pBag->Read(L"Video.PixelHeight", &pV, NULL)) && SUCCEEDED(pV.ChangeType(VT_UI4)))
			CodecContext->coded_height = pV.uintVal;

		pV.Clear();
		if (SUCCEEDED(pBag->Read(L"FOURCC", &pV, NULL)) && SUCCEEDED(pV.ChangeType(VT_UI4)))
			FourCC = pV.uintVal;

		pV.Clear();
		if (SUCCEEDED(pBag->Read(L"CodecPrivate", &pV, NULL))) {
			CodecContext->extradata_size = vtSize(pV);
			CodecContext->extradata = static_cast<uint8_t*>(av_mallocz(CodecContext->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE));
			vtCopy(pV, CodecContext->extradata);
		}
	}
	else if (TT == TT_AUDIO) {
		pV.Clear();
		if (SUCCEEDED(pBag->Read(L"CodecPrivate", &pV, NULL))) {
			CodecContext->extradata_size = vtSize(pV);
			CodecContext->extradata = static_cast<uint8_t*>(av_mallocz(CodecContext->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE));
			vtCopy(pV, CodecContext->extradata);
		}

		pV.Clear();
		if (SUCCEEDED(pBag->Read(L"Audio.SamplingFreq", &pV, NULL)) && SUCCEEDED(pV.ChangeType(VT_UI4)))
			CodecContext->sample_rate = pV.uintVal;

		pV.Clear();
		if (SUCCEEDED(pBag->Read(L"Audio.BitDepth", &pV, NULL)) && SUCCEEDED(pV.ChangeType(VT_UI4)))
			CodecContext->bits_per_coded_sample = pV.uintVal;

		pV.Clear();
		if (SUCCEEDED(pBag->Read(L"Audio.Channels", &pV, NULL)) && SUCCEEDED(pV.ChangeType(VT_UI4)))
			CodecContext->channels = pV.uintVal;
	}

	pV.Clear();
	if (SUCCEEDED(pBag->Read(L"CodecID", &pV, NULL)) && SUCCEEDED(pV.ChangeType(VT_BSTR))) {
		char CodecStr[2048];
		wcstombs(CodecStr, pV.bstrVal, 2000);

		CodecContext->codec = avcodec_find_decoder(MatroskaToFFCodecID(CodecStr, CodecContext->extradata, FourCC, CodecContext->bits_per_coded_sample));
	}
	return CodecContext;
}
开发者ID:VFR-maniac,项目名称:ffmpegsource,代码行数:60,代码来源:utils.cpp

示例2: SubscribeQuote

//-----------------------------------------------------------------------------------------------//
STDMETHODIMP CMyTrackPriceInfoWithNotify::SubscribeQuote(QuoteUpdateParams *Params)
{
	ATLTRACE(_T("CMyTrackPriceInfoWithNotify::SubscribeQuote\n"));
	CComVariant varParams;
	try
	{
		//		ResetEvent(m_hDisconnect);

		_bstr_t bstrSymbol;
		_bstr_t bstrExchange;
		GetParams(varParams,Params);
		bstrSymbol = Params->Symbol;
		if(Params->Exchange)
			bstrExchange = Params->Exchange;

		_Module.GetMyTrackCore ()->SubscribeQuote(static_cast<CBaseNotifier*>(this),
			Params->Type,
			(LPCSTR)bstrSymbol,
			(LPCSTR)bstrExchange,
			varParams);
	}
	catch (_com_error &err)
	{
		return eg_lib::utils::ComError2ErrInfo (err,this);
	}
	varParams.Clear ();
	return S_OK;
}
开发者ID:AlexS2172,项目名称:IVRMstandard,代码行数:29,代码来源:mytrackpriceinfowithnotify.cpp

示例3: Close

void CBoxHttpServer::Close(void)
{
	CBoxTcpServer::Close();

	if(m_pSendThread)
	{
		QueueUserAPC(StopSendThread, m_pSendThread->m_hThread, (ULONG_PTR)this);

		while(m_pSendThread)
			Sleep(1);
	}

	CBoxObject<CBoxHttpHost> pHost;
	CComVariant var;
	int i;
	int count = m_pContents->get_Count();

	for(i = 0; i < count; i ++)
	{
		var.Clear();
		m_pContents->GetValue(i, var);
		if(var.vt == VT_DISPATCH)
		{
			pHost = var.pdispVal;
			if(pHost != NULL)
				pHost->OnEnd();
		}
	}
}
开发者ID:2Quico,项目名称:netbox,代码行数:29,代码来源:BoxHttpServer.cpp

示例4: OnStart

void CBoxHttpHost::OnStart(void)
{
	if(m_bIsStart)return;
	m_bIsStart = TRUE;

	CSingleLock l(&m_cs, TRUE);

	CallEvent(L"OnApplicationStart", NULL, NULL, TRUE);

	CBoxObject<CBoxHttpHost> pHost;
	CComVariant var;
	int i;
	int count = m_pContents->get_Count();

	for(i = 0; i < count; i ++)
	{
		var.Clear();
		m_pContents->GetValue(i, var);
		if(var.vt == VT_DISPATCH)
		{
			pHost = var.pdispVal;
			if(pHost != NULL)
				pHost->OnStart();
		}
	}
}
开发者ID:2Quico,项目名称:netbox,代码行数:26,代码来源:BoxHttpHost.cpp

示例5: OnSleepTimer

void CBoxHttpServer::OnSleepTimer(__int64 nNowTime)
{
    CBoxTcpServer::OnSleepTimer(nNowTime);

	if(m_nLastCheckTime != nNowTime)
	{
		m_nLastCheckTime = nNowTime;

		CBoxObject<CBoxHttpHost> pHost;
		CComVariant var;
		int i;
		int count = m_pContents->get_Count();

		for(i = 0; i < count; i ++)
		{
			var.Clear();
			m_pContents->GetValue(i, var);
			if(var.vt == VT_DISPATCH)
			{
				pHost = var.pdispVal;
				if(pHost != NULL)
					pHost->ClearSession(m_nLastCheckTime);
			}
		}
	}
}
开发者ID:2Quico,项目名称:netbox,代码行数:26,代码来源:BoxHttpServer.cpp

示例6: RequestOptions

STDMETHODIMP CTrackDataStructureProvider::RequestOptions(OptionParams *Params)
{
	CComVariant varParams;
	USES_CONVERSION;
	try
	{ 

		_OptionParams op;
		op.Init();
		op->UnderlyingSymbol = SysAllocString(Params->UnderlyingSymbol);
		op->Exchange = SysAllocString(Params->Exchange);
		op.CopyTo(varParams);

		RT_SYMBOL symbol;
		ZeroMemory(&symbol, sizeof(RT_SYMBOL)); 
		if(Params->UnderlyingSymbol)
			strncpy(symbol.name,W2A(Params->UnderlyingSymbol),10);

		if(Params->Exchange)
			strncpy(symbol.exchange, W2A(Params->Exchange),2);

		m_Client.RequestOptions(this, &symbol, varParams);
	}
	catch (_com_error &err)
	{
		return utils::ComError2ErrInfo (err,this);
	}
	varParams.Clear ();
	return S_OK;

}
开发者ID:AlexS2172,项目名称:IVRM,代码行数:31,代码来源:trackdatastructureprovider.cpp

示例7: RequestStock

/////////////////////////////////////////////////////////////////////////////
// CTrackDataStructureProvider
STDMETHODIMP CTrackDataStructureProvider::RequestStock(StockParams *Params)
{
	CComVariant varParams;
	USES_CONVERSION;
	try
	{

		RT_SYMBOL symbol;
		ZeroMemory(&symbol, sizeof(RT_SYMBOL)); 
		if(Params->Stock)
			strncpy(symbol.name,W2A(Params->Stock),10);

		if(Params->Exchange)
			strncpy(symbol.exchange, W2A(Params->Exchange),2);

		_StockParams op;
		op.Init();
		op->Stock = Params->Stock;
		op->Exchange = Params->Exchange;
		op.CopyTo(varParams);


		if(RT_ERR_OK == m_Client.RequestSymbol(this, &symbol, varParams))
		{
		}
	}
	catch (_com_error &err)
	{
		return utils::ComError2ErrInfo (err,this);
	}
	varParams.Clear ();
	return S_OK;
}
开发者ID:AlexS2172,项目名称:IVRM,代码行数:35,代码来源:trackdatastructureprovider.cpp

示例8:

HRESULT CAzAppGroup::CopyVersion2Constructs(CAzAppGroup &srcAppGroup) {

    static unsigned int rgProperties[]={AZ_PROP_GROUP_BIZRULE,AZ_PROP_GROUP_BIZRULE_LANGUAGE,AZ_PROP_GROUP_BIZRULE_IMPORTED_PATH};

    CComVariant cVVar;

    HRESULT hr=S_OK;

    if (!CAzGlobalOptions::m_bVersionTwo)
        goto lDone;

    for (long i=0;i<3;i++) {

        hr=srcAppGroup.m_native->GetProperty(rgProperties[i],CComVariant(), &cVVar);

        CAzLogging::Log(hr,_TEXT("Getting IAzApplicationGroup Property ID:"),COLE2T(srcAppGroup.getName()),rgProperties[i]);

        if (SUCCEEDED(hr) && (SysStringByteLen(cVVar.bstrVal))!=0) {

            hr=m_native->SetProperty(rgProperties[i],cVVar,CComVariant());

            CAzLogging::Log(hr,_TEXT("Setting IAzApplicationGroup Property ID:"),COLE2T(getName()),rgProperties[i]);

            cVVar.Clear();

        }

    }
lDone:
    return hr;
}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:31,代码来源:AzAppGroup.cpp

示例9: CopyLinks

HRESULT CAzAppGroup::CopyLinks(CAzAppGroup &srcAppGroup) {

    CAzLogging::Entering(_TEXT("CopyLinks"));

    CComVariant cVVar;

    HRESULT hr;

    hr=srcAppGroup.m_native->get_AppMembers(&cVVar);

    CAzLogging::Log(hr,_TEXT("Getting App Members for App Group"),COLE2T(srcAppGroup.getName()));

    if (SUCCEEDED(hr)) {

        hr=InitializeUsingSafeArray(cVVar,&IAzApplicationGroup::AddAppMember );

        CAzLogging::Log(hr,_TEXT("Setting App Members for App Group"),COLE2T(getName()));

        cVVar.Clear();
    }

    hr=srcAppGroup.m_native->get_AppNonMembers(&cVVar);

    CAzLogging::Log(hr,_TEXT("Getting App Non Members for App Group"),COLE2T(srcAppGroup.getName()));

    if (SUCCEEDED(hr)) {

        hr=InitializeUsingSafeArray(cVVar,&IAzApplicationGroup::AddAppNonMember );

        CAzLogging::Log(hr,_TEXT("Setting App Non Members for App Group"),COLE2T(getName()));

        cVVar.Clear();
    }

    hr=m_native->Submit(0,CComVariant());

    CAzLogging::Log(hr,_TEXT("Submitting for App Group"),COLE2T(getName()));

    CAzLogging::Exiting(_TEXT("CopyLinks"));

    return hr;
}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:42,代码来源:AzAppGroup.cpp

示例10: waitForLabviewBoolean

void lvDCOMInterface::waitForLabviewBoolean(BSTR vi_name, BSTR control_name, bool value)
{
	CComVariant v;
	bool done = false;
	while(!done)
	{
		getLabviewValue(vi_name, control_name, &v);
		if ( v.ChangeType(VT_BOOL) == S_OK )
		{
			done = ( v.boolVal == (value ? VARIANT_TRUE : VARIANT_FALSE) );
			v.Clear();
		}
		epicsThreadSleep(0.1);
	}	
}	
开发者ID:ISISComputingGroup,项目名称:EPICS-lvDCOM,代码行数:15,代码来源:lvDCOMInterface.cpp

示例11: get_Keys

STDMETHODIMP CAvatarProfileObject::get_Keys(IPropertyList** ppKeyList)
{
	HRESULT hr = S_OK;
	IAvatarProfileData* pProfileData = NULL;
	CComBSTR curStr;
	VARIANT_BOOL bDone;
	CComVariant varVal;
	long cKeys = 0;
	
	if (ppKeyList == NULL)
		return E_POINTER;

	*ppKeyList = NULL;

	if (m_pKeys == NULL)
	{
		VWTRACE(m_pWorld, "VWPROPERTY", VWT_ERROR, "CAvatarProfileObject::get_Keys: invalid key map\n");
		hr = VWAVATARPROFILE_E_INVALIDKEYMAP;
		goto ERROR_ENCOUNTERED;
	}

	hr = CreatePropertyList(m_pWorld, ppKeyList);
	if (FAILED(hr) || (!*ppKeyList))
		goto ERROR_ENCOUNTERED;

	// map over the key list, collecting the names of valid keys
	m_pKeys->FirstItem(&curStr.m_str, &varVal, &bDone);

	while (bDone == VARIANT_FALSE)
	{
		hr = m_pKeys->get_ObjectProperty(curStr, (IObjectProperty **)&pProfileData);
		if (SUCCEEDED(hr) && pProfileData)
		{
			if (IsKeyReadable(pProfileData))
				(*ppKeyList)->AddString(curStr);

			SAFERELEASE(pProfileData);
		}

		curStr.Empty();
		varVal.Clear();

		m_pKeys->NextItem(&curStr.m_str, &varVal, &bDone);
	}
		
ERROR_ENCOUNTERED:
	return hr;
}
开发者ID:opensim4opencog,项目名称:PrologVirtualWorlds,代码行数:48,代码来源:profobj.cpp

示例12: Save

STDMETHODIMP CLogoMarkerSymbol::Save(IVariantStream *Stream)
{
	CComVariant vSave;
	HRESULT hr;
	
	//persist ISymbol properties 
	vSave = (long)m_lROP2;
	if (FAILED(hr = Stream->Write(vSave))) return hr;

	//persist IMarkerSymbol properties
	vSave = m_dSize;
	if (FAILED(hr = Stream->Write(vSave))) return hr;
	vSave = m_dXOffset;
	if (FAILED(hr = Stream->Write(vSave))) return hr;
	vSave = m_dYOffset;
	if (FAILED(hr = Stream->Write(vSave))) return hr;
	vSave = m_dAngle;
	if (FAILED(hr = Stream->Write(vSave))) return hr;
	
	//persist ISymbolRotation properties
	// CComVariant does not have assignment operator
	// for VARIANT_BOOL, so do this as for the raw datatype
	vSave.Clear();
	vSave.vt = VT_BOOL;
	vSave.boolVal = m_bRotWithTrans;
	if (FAILED(hr = Stream->Write(vSave))) return hr;

	//persist IMapLevel properties
	vSave = m_lMapLevel;
	if (FAILED(hr = Stream->Write(vSave))) return hr;

	//persist custom properties
	vSave = (IUnknown*)m_ipTopColor;
	if (FAILED(hr = Stream->Write(vSave))) return hr;
	vSave = (IUnknown*)m_ipLeftColor;
	if (FAILED(hr = Stream->Write(vSave))) return hr;
	vSave = (IUnknown*)m_ipRightColor;
	if (FAILED(hr = Stream->Write(vSave))) return hr;
	vSave = (IUnknown*)m_ipBorderColor;
	if (FAILED(hr = Stream->Write(vSave))) return hr;

	return S_OK;
}
开发者ID:Aleksei-Iagur,项目名称:arcobjects-sdk-community-samples,代码行数:43,代码来源:LogoMarkerSymbol.cpp

示例13: Start

void CBoxHttpServer::Start(void)
{
	CBoxObject<CBoxHttpHost> pHost;
	CComVariant var;
	int i;
	int count = m_pContents->get_Count();

	for(i = 0; i < count; i ++)
	{
		var.Clear();
		m_pContents->GetValue(i, var);
		if(var.vt == VT_DISPATCH)
		{
			pHost = var.pdispVal;
			if(pHost != NULL)
				pHost->OnStart();
		}
	}

	CBoxTcpServer::Start();
}
开发者ID:2Quico,项目名称:netbox,代码行数:21,代码来源:BoxHttpServer.cpp

示例14: Start

	void DensoRobot::Start()
	{
		/* Start the motor */
		CComVariant pVal; // probably empty
		hr = pRobot->Execute(CComBSTR(L"Motor"), CComVariant(L"1"), &pVal);
		if(FAILED(hr)) throw exception("Failed to start the robot motor!");

		/* Set the external robot speed TO DO*/ 
		CComVariant parameters; 
        parameters.vt = VT_ARRAY | VT_VARIANT; 

        SAFEARRAYBOUND bounds[1]; 
        bounds[0].lLbound = 0; 
        bounds[0].cElements = 3; 
        parameters.parray = SafeArrayCreate(VT_VARIANT, 1, bounds); 

        CComVariant varSpeed; 
        varSpeed.vt = VT_R4; 
        varSpeed.fltVal = (float)this->robotSpeed; 

        CComVariant varAcceleration; 
        varAcceleration.vt = VT_R4; 
        varAcceleration.fltVal = (float)(this->robotSpeed*this->robotSpeed/100); 

        CComVariant varDeceleration; 
		varDeceleration.vt = VT_R4; 
        varDeceleration.fltVal = (float)(this->robotSpeed*this->robotSpeed/100); 

		long index = 0; 
        SafeArrayPutElement(parameters.parray, &index, &varSpeed); 
        index = 1; 
		SafeArrayPutElement(parameters.parray, &index, &varAcceleration); 
        index = 2; 
        SafeArrayPutElement(parameters.parray, &index, &varDeceleration); 

        CComVariant vntDummy; 
        hr = pRobot->Execute(CComBSTR(L"ExtSpeed"), parameters, &vntDummy); 
		if(FAILED(hr)) throw exception("Failed to set the external robot speed!");
        parameters.Clear(); 
	}
开发者ID:Pieter-Jan,项目名称:PJLib,代码行数:40,代码来源:DensoRobot.cpp

示例15: GetTagValue

STDMETHODIMP CPictHolder::GetTagValue(long tag, VARIANT* pValue)
{
    if( !pValue )
        return E_POINTER;
    if( !m_pPicture )
        return E_FAIL;
    if( !m_pPicture )
        return E_FAIL;
    HRESULT	hr = E_FAIL;
    try {
        TAG	t;
        CComVariant	v;
        v.Clear();
        m_pPicture->GetTag( (PICT_PROPERTY)tag, t );
        switch( t.Type() ) {
        case _DOUBLE :
            v = t.dVal();
            break;
        case _LONG :
            v = t.slVal();
            break;
        case _SLONG :
            v = (long) t.ulVal();
            break;
        case _SSHORT :
            v = t.ssVal();
            break;
        case _ASCII :
            v = t.strVal();
            break;
        }
        if( VT_EMPTY != v.vt ) {
            *pValue = v;
            hr = S_OK;
        }
    } catch(...) {
        hr = E_UNEXPECTED;
    }
    return hr;
}
开发者ID:hkaiser,项目名称:TRiAS,代码行数:40,代码来源:PictHolder.cpp


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