您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CComVariant函数代码示例

51自学网 2021-06-01 19:57:54
  C++
这篇教程C++ CComVariant函数代码示例写得很实用,希望能帮到您。

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

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

示例1: CHECKOUTPARAM

//This is used to get the value for an element in a group.//The element is identified by the dwCookie parameterSTDMETHODIMP CComPolygon::GetElementValue(	/* [in] */ DISPID dispID,	/* [in] */ DWORD dwCookie,	/* [out] */ VARIANT * pVarOut){    CHECKOUTPARAM(pVarOut);    if (dispID >= DISPID_NORMAL && dispID <= DISPID_STARTPOINT)    {        try        {            if (dwCookie>2)                throw Acad::eInvalidInput;            Acad::ErrorStatus es;            AcAxObjectRefPtr<AsdkPoly> pPoly(&m_objRef,AcDb::kForRead,Adesk::kTrue);	        if((es=pPoly.openStatus()) != Acad::eOk)                throw es;            AcAxPoint3d pt;			Adesk::Boolean bAsVector=Adesk::kFalse;			if (dispID == DISPID_NORMAL)            {                pt = pPoly->normal();                //translate from wcs to ucs                acdbWcs2Ucs(asDblArray(pt),asDblArray(pt),Adesk::kTrue);                ::VariantCopy(pVarOut,&CComVariant(pt[dwCookie]));            } else {                AcAxPoint2d pt2d;			    switch (dispID)			    {			    case DISPID_CENTER:				    pt2d = pPoly->center();				    break;			    case DISPID_STARTPOINT:				    pt2d = pPoly->startPoint();				    break;			    default:				    throw Acad::eInvalidInput;			    }                pt.set(pt2d.x,pt2d.y,pPoly->elevation());                //translate from wcs to ucs                acdbEcs2Ucs(asDblArray(pt),asDblArray(pt),asDblArray(pPoly->normal()),Adesk::kFalse);                ::VariantCopy(pVarOut,&CComVariant(pt[dwCookie]));            }        }        catch(const Acad::ErrorStatus)        {            return Error(L"Failed to open object",IID_IComPolygon,E_FAIL);        }        catch(const HRESULT hr)        {            return Error(L"Invalid argument.",IID_IComPolygon,hr);        }    }	return S_OK;}
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:57,


示例2: SysAllocString

void WebHandler::GetChatMessage(){    CComQIPtr<IHTMLElementCollection> allElements;    HRESULT hr = S_FALSE;    //hr = htmlDocument_->get_all(&allElements);	//取得表单集合    //if (FAILED(hr))    //    return;    CComQIPtr<IHTMLElementCollection> scrpitsCollection;    htmlDocument_->get_scripts(&scrpitsCollection);    if (FAILED(hr))        return;    long nItemCount = 0;				//取得表单数目    hr = scrpitsCollection->get_length(&nItemCount);    if (FAILED(hr))        return;    BSTR pstr = SysAllocString(L"");;        hr = scrpitsCollection->toString(&pstr);    if (FAILED(hr))        return;    for (long i = 0; i < nItemCount; i++)    {        CComDispatchDriver spDisp;	//取得第 j 项表单域        hr = scrpitsCollection->item(CComVariant(i), CComVariant(), &spDisp);        if (FAILED(hr))            continue;        CComQIPtr<IHTMLElement> spElement = spDisp;        if (!spElement)            break;        CComBSTR className;        std::wstring compareStr;        hr = spElement->get_className(&className);        if (FAILED(hr))            continue;        if (className)        {            compareStr = (LPCTSTR)className;        }            }    // 未成功    //DISPID dispid;    //OLECHAR FAR* funcName = L"click";    //CComBSTR funNameStr(funcName);    //hr = scrpitsCollection->GetIDsOfNames(IID_NULL, &funNameStr, 1, LOCALE_SYSTEM_DEFAULT, &dispid);    //if (FAILED(hr))    //    return;}
开发者ID:michaelforfxhelp,项目名称:fxhelprepo,代码行数:54,


示例3: PinOrUnpinCmd

//5386 pinint PinOrUnpinCmd(int iResIndex){	char szPath[MAX_PATH];	if(!CLhcImg::GetHomePath(szPath, MAX_PATH))		return 0;	string strDirPath = string(szPath);	if (strDirPath.empty())		return 0;	string strFileName = "PlayBox.exe";	HMODULE hShell32 = ::LoadLibrary("shell32.dll");	if (!hShell32)		return 1;	char szCmd[512];	int nLen = ::LoadString(hShell32, iResIndex, szCmd, 512);	::CoInitialize(NULL);	CComPtr<IShellDispatch> pShell;	if (FAILED(::CoCreateInstance(CLSID_Shell, NULL, CLSCTX_SERVER, IID_IDispatch, (LPVOID*)&pShell)) || !pShell)		return 1;	CComPtr<Folder> pFolder;	if (FAILED(pShell->NameSpace(CComVariant(strDirPath.c_str()), &pFolder)) || !pFolder)		return 1;	CComPtr<FolderItem> pItem;	if (FAILED(pFolder->ParseName(CComBSTR(strFileName.c_str()), &pItem)) || !pItem)		return 1;	CComPtr<FolderItemVerbs> pItemVerbs;	if (FAILED(pItem->Verbs(&pItemVerbs)) || !pItemVerbs)		return 1;	long lCount = 0;	pItemVerbs->get_Count(&lCount);	for (long i = 0; i < lCount; i++)	{		CComPtr<FolderItemVerb> pItemVerb;		pItemVerbs->Item(CComVariant(i), &pItemVerb);		if (pItemVerb)		{			CComBSTR bstrName;			pItemVerb->get_Name(&bstrName);			if (bstrName == szCmd)			{				pItemVerb->DoIt();				return 0;			}		}	}	return 0;}
开发者ID:linjianbjfu,项目名称:PlayBox,代码行数:53,


示例4: AFX_MANAGE_STATE

STDMETHODIMP CFoundationExemplars::TMchOnCreate(IThing* pThing){	AFX_MANAGE_STATE(AfxGetStaticModuleState())	CComPtr<IThing> pThis;    HRESULT         hr;    	if (FAILED(hr = m_pWorld->get_This(&pThis)))		goto ERROR_ENCOUNTERED;		if (pThis)	{		//Create a display and set the TransactionMachine.Display to it		CComPtr<IThing> pDisplay;		CComPtr<IVWGeometry> pGeometry;		CComPtr<IThing> pPrevBtn;		CComPtr<IThing> pNextBtn;		CComPtr<IThing> pSelectBtn;				if (FAILED(hr = m_pWorld->CreateInstanceExt(CComBSTR("Display"),														 CComVariant(CComBSTR("Display")), pThis,														 &pDisplay)))		    goto ERROR_ENCOUNTERED;				if (FAILED(hr = pThis->put_ObjectProperty(CComBSTR("Display"), (IObjectProperty*) pDisplay)))		    goto ERROR_ENCOUNTERED;		// Add buttons to contents		if (FAILED(hr = m_pWorld->CreateInstanceExt(CComBSTR("PreviousButton"),														 CComVariant(CComBSTR("PreviousButton")), pThis,														 &pPrevBtn)))		    goto ERROR_ENCOUNTERED;		if (FAILED(hr = m_pWorld->CreateInstanceExt(CComBSTR("NextButton"),														 CComVariant(CComBSTR("NextButton")), pThis,														 &pNextBtn)))		    goto ERROR_ENCOUNTERED;		if (FAILED(hr = m_pWorld->CreateInstanceExt(CComBSTR("SelectButton"),														 CComVariant(CComBSTR("SelectButton")), pThis,														 &pSelectBtn)))		    goto ERROR_ENCOUNTERED;	}    return S_OK;ERROR_ENCOUNTERED:        VWTRACE(m_pWorld, "VWFOUND", VWT_ERROR, "CFoundationExemplars::TMchOnCreate  Error %x", hr);	return hr;}
开发者ID:opensim4opencog,项目名称:PrologVirtualWorlds,代码行数:52,


示例5: Copy

HRESULT CAzRole::Copy(CAzRole &srcRole) {    CAzLogging::Entering(_TEXT("CAzRole::Copy"));    CComBSTR bstrData;    HRESULT hr=m_native->Submit(0,CComVariant());    CAzLogging::Log(hr,_TEXT("Submitting for role"),COLE2T(getName()));    if (FAILED(hr))        goto lError1;    hr=srcRole.m_native->get_Description(&bstrData);    CAzLogging::Log(hr,_TEXT("Getting Description for role"),COLE2T(getName()));    if (SUCCEEDED(hr)) {        hr=m_native->put_Description(bstrData);        CAzLogging::Log(hr,_TEXT("Setting Description for role"),COLE2T(getName()));        bstrData.Empty();    }    hr=srcRole.m_native->get_ApplicationData(&bstrData);    CAzLogging::Log(hr,_TEXT("Getting ApplicationData for role"),COLE2T(getName()));    if (SUCCEEDED(hr)) {        hr=m_native->put_ApplicationData(bstrData);        CAzLogging::Log(hr,_TEXT("Setting ApplicationData for role"),COLE2T(getName()));    }    hr=CopyUserData(srcRole);    CAzLogging::Log(hr,_TEXT("CopyUserData for role"),COLE2T(getName()));    hr=m_native->Submit(0,CComVariant());    CAzLogging::Log(hr,_TEXT("Submitting for role"),COLE2T(getName()));lError1:    CAzLogging::Exiting(_TEXT("CAzRole::Copy"));    return hr;}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:51,


示例6: pModuleRequireOb

//----------------------------------------------------------------------------//  RunModuleHRESULT CMagpieActiveScript::RunModule(  CMagpieModule* pModule){  CComPtr<IDispatch> pModuleRequireOb(pModule->GetRequire());  if (!pModuleRequireOb)  {    return E_UNEXPECTED;  }  CString sFilename, sModuleID;  pModule->GetID(sModuleID);  pModule->GetFilename(sFilename);  m_ScriptEngine->SetScriptState(SCRIPTSTATE_DISCONNECTED);  // add namespace for module  IF_FAILED_RET(m_ScriptEngine->AddNamedItem(sModuleID, SCRIPTITEM_CODEONLY));  // dispatch for module's namespace  CIDispatchHelper script;  IF_FAILED_RET(m_ScriptEngine->GetScriptDispatch(sModuleID, &script));  // create exports object  CIDispatchHelper scriptGlobal;  IF_FAILED_RET(m_ScriptEngine->GetScriptDispatch(NULL, &scriptGlobal));  CComPtr<IDispatch> pModuleExportsOb;  IF_FAILED_RET(scriptGlobal.CreateObject(L"Object", &pModuleExportsOb));  // inject CommonJS objects  script.SetPropertyByRef(L"require", CComVariant(pModuleRequireOb));  script.SetPropertyByRef(L"module", CComVariant(pModule));  script.SetPropertyByRef(L"exports", CComVariant(pModuleExportsOb));  CComVariant vtSalsita;  HRESULT hr = GetSalsitaObject(&vtSalsita);  if (SUCCEEDED(hr))  {    script.SetPropertyByRef(L"salsita", vtSalsita);  }  // now run the module  m_Application.EnterModule(sModuleID);  hr = LoadScriptFile(sFilename, sModuleID);  if (SUCCEEDED(hr))  {    m_ScriptEngine->SetScriptState(SCRIPTSTATE_CONNECTED);  }  m_Application.ExitModule();  return S_OK;}
开发者ID:ondravondra,项目名称:adobo-ie,代码行数:53,


示例7: RETURN_HRESULT

HRESULT CbDevice::EnableSwClocking(){        double maxRate, minRate;    //    // It is possible that the hardware will not have the same capabilities as our software clocking    // In this case we must adjust our assumptions as to what the MIN and MAX sampling rates     // should be.    //    // Decide the true maximum sampling rate    if(_maxSampleRate < MAX_SW_SAMPLERATE)		maxRate = _maxSampleRate;    else		maxRate = MAX_SW_SAMPLERATE;    // Decide the true minimum sampling rate    if(_minSampleRate > MIN_SW_SAMPLERATE)		minRate = _minSampleRate;    else		minRate = MIN_SW_SAMPLERATE;        RETURN_HRESULT(pSampleRate.SetRange(minRate, maxRate));	// Set the default rate to 1/5 the max rate	double defaultRate = int(maxRate/5);	pSampleRate.SetDefaultValue(defaultRate);	// Range check the existing sample rate    if (pSampleRate>maxRate)	{        pSampleRate=maxRate;	}    else if (pSampleRate<minRate)	{        pSampleRate=minRate;	}	// If this HW only supports SW Clocking then set the sample rate to the default    if ( _ClockingType == SOFTWARE )	{		pSampleRate = defaultRate;	}    pSampleRate=RoundRate(pSampleRate);    RETURN_HRESULT(_DaqHwInfo->put_MemberValue(L"minsamplerate", CComVariant(minRate)));	    RETURN_HRESULT(_DaqHwInfo->put_MemberValue(L"maxsamplerate", CComVariant(maxRate)));	    return S_OK;}
开发者ID:motor,项目名称:clock_stimulus,代码行数:50,


示例8: getShellMenu

void SysStatsApp::close(SysStatsClientWindow *window){	getShellMenu()->removeSubMenu(window->getContextMenu());	int pos = windows.find(window);	if (pos > -1)	{		saveTheme();		IClientModel *pModel;		models.Item(CComVariant(pos), &pModel);		models.Remove(CComVariant(pos));		pModel->Release();		delete windows.remove(pos);	}}
开发者ID:Templier,项目名称:desktopx,代码行数:14,


示例9: EnableSwClocking

HRESULT CbDevice::SetClockSource(){    if (_UseSoftwareClock)    {        return EnableSwClocking();    }    else    {        RETURN_HRESULT(_DaqHwInfo->put_MemberValue(L"minsamplerate", CComVariant(_minSampleRate)));	        RETURN_HRESULT(_DaqHwInfo->put_MemberValue(L"maxsamplerate", CComVariant(_maxSampleRate)));	        pSampleRate.SetRange(_minSampleRate,_maxSampleRate);        UpdateRateAndSkew();    }    return S_OK;}
开发者ID:motor,项目名称:clock_stimulus,代码行数:15,


示例10: EnumEmbeds

void EnumEmbeds(IHTMLDocument2 *pIHTMLDocument2){	if(!pIHTMLDocument2) return;	HRESULT hr;	USES_CONVERSION;	CComPtr< IHTMLElementCollection > spEmbedCollection;	hr = pIHTMLDocument2->get_embeds(&spEmbedCollection);	//取得Embed的集合	if (FAILED(hr))	{		cout << _T("错误: 获取Embed集合IHTMLElementCollection!") << endl;		return;	}	long nEmbedCount = 0;				//取得Embed个数	hr = spEmbedCollection->get_length(&nEmbedCount);	if (FAILED(hr))	{		cout << _T("错误: 获取Embed集合IHTMLElementCollection的长度!") << endl;	}	cout << "Embed对象共: " << nEmbedCount << endl;	CComBSTR bstrPluginsPage, bstrSrc;	IDispatch *pDisp = NULL;	CComQIPtr< IHTMLEmbedElement > spEmbedElement;	for(long i = 0; i < nEmbedCount; i++)	{		hr = spEmbedCollection->item(CComVariant(i), CComVariant(), &pDisp);		if (FAILED(hr) || !pDisp) continue;		spEmbedElement = pDisp;		pDisp->Release();				spEmbedElement->get_pluginspage(&bstrPluginsPage);		spEmbedElement->get_src(&bstrSrc);		cout << i + 1			<< ": pluginspage = " << (bstrPluginsPage ? OLE2CT(bstrPluginsPage) : _T(""))			<< ", src = " << (bstrSrc ? OLE2CT(bstrSrc) : _T("")) 			<< endl;	}	if (pDisp) 	{		pDisp->Release();		pDisp = NULL;	}}
开发者ID:harrysun2006,项目名称:07_UltraSpy,代码行数:48,


示例11: CancelLastMmQuote

STDMETHODIMP CISEMMManager::CancelLastMmQuote(VARIANT vtParams){	_EventTypeEnum	Type = _enRequestLastQuote;	CMMQuoteParams	Request;	if(CComVariant(vtParams) != vtMissing)	{		try		{			_ISEMMQuoteParams Params(vtParams);			Request.m_sSymbol = (char*)_bstr_t(Params->Symbol);			if(Request.m_sSymbol.length() == 0)				return Error(L"Invalid symbol name.");			Request.m_Type = Params->Type;			Request.m_BidOrAsk = Params->BidOrAsk;		}		catch(_com_error& e)		{			return e.Error();		}	}	return ((CMMManagerPriceObject*)theISEManager)->RemoveRequest(this, Request, _enRequestLastOption);}
开发者ID:AlexS2172,项目名称:IVRM,代码行数:25,


示例12: BreakOnNull

/** * Method: NativeMessaging::tabs_active * * @param uuid * * @returns Tab */STDMETHODIMP CNativeMessaging::tabs_active(BSTR uuid, IDispatch *callback, UINT *out_tabId){  HRESULT hr = S_OK;  CComPtr<ITypeInfo> tabT = nullptr;  CComPtr<IUnknown>  tabI = nullptr;  for (;;) {    BreakOnNull(out_tabId, hr);    *out_tabId = m_activeTab.id;    BreakOnNull(callback, hr);    hr = ::CreateDispTypeInfo(&Tab::Interface, LOCALE_SYSTEM_DEFAULT, &tabT);    BreakOnFailed(hr);    BreakOnNull(tabT, hr);    hr = ::CreateStdDispatch(NULL, &m_activeTab, tabT, &tabI);    BreakOnFailed(hr);    BreakOnNull(tabI, hr);    hr = CComDispatchDriver(callback).Invoke1((DISPID)0, &CComVariant(tabI));    break;  }  if (FAILED(hr))    logger->error(L"CNativeMessaging::tabs_active failed -> " + logger->parse(hr));  return hr;}
开发者ID:Passpack,项目名称:browser-extensions,代码行数:35,


示例13: _AddMapKey

HRESULT _AddMapKey(IWorld *pWorld, IAvatarProfile *pProfile, BSTR bstrKey, IThing *pOwner){	HRESULT hr = S_OK;	IPropertyMap *pMap = NULL;	hr = CreatePropertyMap(pWorld, &pMap);	if (FAILED(hr))		goto CLEAN_UP;	hr = pProfile->AddKey(bstrKey, CComVariant(pMap), kVarNone, CComVariant(kKeyPublic), CComVariant(pOwner));CLEAN_UP:	SAFERELEASE(pMap);	return hr;}
开发者ID:opensim4opencog,项目名称:PrologVirtualWorlds,代码行数:16,


示例14: SendDlgItemMessage

LRESULT PickList<C>::init(HWND hDlg, WORD wId, ICompositeOverlay *overlays, C curVal){    this->hDlg = hDlg;    this->wId = wId;    BSTR s;    short count;    overlays->Count(&count);    int index = SendDlgItemMessage(hDlg,wId,CB_ADDSTRING,0,(LPARAM)"(none)");    SendDlgItemMessage(hDlg,wId,CB_SETITEMDATA,index,(LPARAM)-1);    if ((*pEquals)(curVal,-1))        SendDlgItemMessage(hDlg,wId,CB_SETCURSEL,(WPARAM)index,0);    for (int i=0; i<count; i++)    {        IOverlay *overlay;        overlays->Item(CComVariant(i), &overlay);        overlay->get_Name(&s);        index = SendDlgItemMessage(hDlg,wId,CB_ADDSTRING,0,(LPARAM)((char*)_bstr_t(s, false)));        SendDlgItemMessage(hDlg,wId,CB_SETITEMDATA,index,(LPARAM)i);        if ((*pEquals)(curVal,i))            SendDlgItemMessage(hDlg,wId,CB_SETCURSEL,(WPARAM)index,0);        overlay->Release();    }    return 1;}
开发者ID:Templier,项目名称:desktopx,代码行数:28,


示例15: IsValid

STDMETHODIMP CMyComX::IsValid(VARIANT_BOOL *ret){	// 
C++ CCopasiMessage函数代码示例
C++ CComBSTR函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。