當前位置: 首頁>>代碼示例>>C++>>正文


C++ CComBSTR類代碼示例

本文整理匯總了C++中CComBSTR的典型用法代碼示例。如果您正苦於以下問題:C++ CComBSTR類的具體用法?C++ CComBSTR怎麽用?C++ CComBSTR使用的例子?那麽恭喜您, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了CComBSTR類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的C++代碼示例。

示例1: while

HRESULT CTypeInfoBrowse::CrackExtendProperty(ICxEnumExtendProperty* pEnum, CPropInfoArray& arrProp)
{
	LONG nIndex;
	HRESULT hr;
	CPropInfo prop;

	pEnum->Reset();
	while (S_FALSE != pEnum->Next(&nIndex))
	{
		hr = pEnum->GetType((LONG *)&prop.m_proptype);
		if (FAILED(hr))
			return hr;
			
		CComBSTR bstr;
		hr = pEnum->GetName(&bstr);
		if (FAILED(hr))
			return hr;
		prop.m_bstrName = bstr;

		bstr.Empty();
		hr = pEnum->GetDescription(&bstr);
		if (FAILED(hr))
			return hr;
		prop.m_bstrDesc = bstr;
	
		hr = pEnum->GetDispid(&prop.m_dispid);
		if (FAILED(hr))
			return hr;
			
		arrProp.Add(prop);
	}
	
	return S_OK;
}
開發者ID:JackWangCUMT,項目名稱:SuperCxHMI,代碼行數:34,代碼來源:TypeInfoBrowse.cpp

示例2: ASSERT

BOOL vmsMetalinkFile::ReadHashNode(IXMLDOMNode *pNode, vmsMetalinkFile_File_Hash *hash)
{
	USES_CONVERSION;

	IXMLDOMNamedNodeMapPtr spAttrs;
	pNode->get_attributes (&spAttrs);
	if (spAttrs == NULL)
		return FALSE;

	IXMLDOMNodePtr spType;
	spAttrs->getNamedItem (L"type", &spType);
	if (spType == NULL)
		return FALSE;

	COleVariant vt;
	spType->get_nodeValue (&vt);
	ASSERT (vt.vt == VT_BSTR);
	if (vt.vt == VT_BSTR)
		hash->strAlgorithm = W2A (vt.bstrVal);
	
	CComBSTR bstrText;
	pNode->get_text (&bstrText);
	if (bstrText.Length () == 0)
		return FALSE;

	hash->strChecksum = W2A (bstrText);

	return TRUE;
}
開發者ID:HackLinux,項目名稱:Free-Download-Manager-vs2010,代碼行數:29,代碼來源:vmsMetalinkFile.cpp

示例3: EncodeStrokeToXML

void CStrokeRecognition::EncodeStrokeToXML(std::vector<BasicStroke> &rgStrokes, BSTR* StrokeResult)
{
	CComBSTR	strokeXML;
	char		szTmp[1024];

	strokeXML = "<?xml version=\"1.0\"?><output><strokes candidatenum=\"1\">";
	sprintf(szTmp, "<candidate similarity=\"1\" strokenum=\"%d\">", rgStrokes.size());
	strokeXML += szTmp;

	for (unsigned int i = 0; i < rgStrokes.size(); i++)
	{
		switch (rgStrokes[i].iStrokeType)
		{
		case PRIMITIVE_SEGMENT:
			{
				sprintf(szTmp, "<line><startpt x=\"%d\" y=\"%d\"/><endpt x=\"%d\" y=\"%d\"/></line>", 
						rgStrokes[i].segment.startPoint.x, rgStrokes[i].segment.startPoint.y, 
						rgStrokes[i].segment.endPoint.x, rgStrokes[i].segment.endPoint.y);
				strokeXML += szTmp;
			}
			break;
		case PRIMITIVE_ARC:
			{
				double	x1, y1, x2, y2;
				double	cx, cy, a, b;

				cx	= (rgStrokes[i].arc.rcBounding.left + rgStrokes[i].arc.rcBounding.right) / 2;
				cy	= (rgStrokes[i].arc.rcBounding.top + rgStrokes[i].arc.rcBounding.bottom) / 2;
				a	= (rgStrokes[i].arc.rcBounding.right - rgStrokes[i].arc.rcBounding.left) / 2;
				b	= (rgStrokes[i].arc.rcBounding.bottom - rgStrokes[i].arc.rcBounding.top) / 2;

				CalcEllipsePointByAngle(cx, cy, a, b, 0, ConvertToEllipseAngle(rgStrokes[i].arc.startAngle, a, b), x1, y1);
				CalcEllipsePointByAngle(cx, cy, a, b, 0, ConvertToEllipseAngle(rgStrokes[i].arc.endAngle, a, b), x2, y2);

				if (rgStrokes[i].arc.endAngle - rgStrokes[i].arc.startAngle >= 1.9 * PI)
				{
					sprintf(szTmp, "<arc rotate=\"%f\"><startpt x=\"%d\" y=\"%d\"/><endpt x=\"%d\" y=\"%d\"/><ltpt x=\"%d\" y=\"%d\"/><rbpt x=\"%d\" y=\"%d\"/></arc>", 
						(float)(rgStrokes[i].arc.rotateAngle), 
						(int)x1, (int)y1, (int)x1, (int)y1,
						rgStrokes[i].arc.rcBounding.left, rgStrokes[i].arc.rcBounding.top, 
						rgStrokes[i].arc.rcBounding.right, rgStrokes[i].arc.rcBounding.bottom);
				}
				else
				{
					sprintf(szTmp, "<arc rotate=\"%f\"><startpt x=\"%d\" y=\"%d\"/><endpt x=\"%d\" y=\"%d\"/><ltpt x=\"%d\" y=\"%d\"/><rbpt x=\"%d\" y=\"%d\"/></arc>", 
						(float)(rgStrokes[i].arc.rotateAngle), 
						(int)x1, (int)y1, (int)x2, (int)y2,
						rgStrokes[i].arc.rcBounding.left, rgStrokes[i].arc.rcBounding.top, 
						rgStrokes[i].arc.rcBounding.right, rgStrokes[i].arc.rcBounding.bottom);
				}
				strokeXML += szTmp;
			}
			break;
		}
	}

	strokeXML += "</candidate></strokes></output>";

	strokeXML.CopyTo(StrokeResult);
}
開發者ID:sanyaade-g2g-repos,項目名稱:quickdiagram,代碼行數:60,代碼來源:StrokeRecognition.cpp

示例4: DateTime_Evaluate

//extern "C" {
HRESULT WINAPI DateTime_Evaluate( DWORD dwAddress, DEBUGHELPER *pHelper, int nBase, BOOL bUniStrings, char *pResult, size_t maxlen, DWORD reserved )
{
	DATE Time;
	DWORDLONG address = GetAddress( pHelper, dwAddress);

	if( !ReadMem( pHelper, address, &Time) )
		return E_FAIL;

	if(Time == 0.)
	{
		strcpy(pResult, "zero");
		return S_OK;
	}
	if(Time == ( 65535. * 2147483647. ) || Time == (2147483647.))
	{
		strcpy(pResult, "invalid");
		return S_OK;
	}
	if(Time == ( 65535. * 2147483648. ) || Time == (2147483648.))
	{
		strcpy(pResult, "null");
		return S_OK;
	}

	CComBSTR strDate ;
	HRESULT hr = VarBstrFromDate(Time, LOCALE_USER_DEFAULT, 0, &strDate);
	if (FAILED(hr)) return hr;
	
	if(strDate != 0)
		WideCharToMultiByte(CP_ACP, 0, strDate, strDate.Length(), pResult, maxlen , NULL, NULL);

	return S_OK;
	
}
開發者ID:UIKit0,項目名稱:comet,代碼行數:35,代碼來源:CometAutoExp.cpp

示例5: LOWORD

LRESULT CShellViewImpl::OnMenuSelect(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
WORD wMenuID = LOWORD(wParam);
WORD wFlags = HIWORD(wParam);

    // If the selected menu item is one of ours, show a flyby help string
    // in the Explorer status bar.

    if ( !(wFlags & MF_POPUP) )
        {
        switch ( wMenuID )
            {
            case IDC_EXPLORE_DRIVE:
            case IDC_SYS_PROPERTIES:
            case IDC_ABOUT_SIMPLENS:
                {
                CComBSTR bsHelpText;

                if ( bsHelpText.LoadString ( wMenuID ))
                    {
                    m_spShellBrowser->SetStatusTextSB ( bsHelpText.m_str );
                    }

                return 0;
                }
            break;
            }
        }

    // Otherwise, pass the message to the default handler.
    return DefWindowProc();
}
開發者ID:cugxiangzhenwei,項目名稱:MySrcCode,代碼行數:32,代碼來源:ShellViewImpl.cpp

示例6: SaveWhiteboardSettingsData

/****************************************
** Author:      Joe Li
** Purpose:     Save whiteboard settings data
** Comments:  
****************************************/ 
bool DOSaveAppData::SaveWhiteboardSettingsData(const CComBSTR& sourcePath, const CComBSTR& targetPath)
{
    if (sourcePath.Length() != 0 && targetPath.Length() != 0)
    {
        const unsigned long bufferSize = 256;
        TCHAR buffer[bufferSize];

        DOPersistentFile sourceFile;

        // Search for first source file
        if (sourceFile.FindFirstFile(sourcePath, WHITEBOARD_SETTINGS_WILDCARD_SEARCH, buffer, bufferSize) == true)
        {
            CComBSTR sourceFileName = buffer;
            bool allWhiteboardSettingsSaved = SaveWhiteboardSettings(sourcePath, sourceFileName, targetPath);

            // Search of remaining source file(s)
            while (sourceFile.FindNextFile(buffer, bufferSize) == true)
            {
                sourceFileName = buffer;
                allWhiteboardSettingsSaved = SaveWhiteboardSettings(sourcePath, sourceFileName, targetPath) && allWhiteboardSettingsSaved;
            }

            return allWhiteboardSettingsSaved;
        }
    }

    return false;
}
開發者ID:MakSim345,項目名稱:cpp,代碼行數:33,代碼來源:SaveAppData.cpp

示例7: SetValueAsString

    HRESULT Property::SetValueAsString( 
        LPCOLESTR pszValue,
        DWORD dwRadix,
        DWORD dwTimeout )
    {
        // even though it could be read only, let's parse and eval, so we get good errors

        HRESULT         hr = S_OK;
        CComBSTR        assignExprText = mFullExprText;
        CComBSTR        errStr;
        UINT            errPos;
        CComPtr<IDebugExpression2>  expr;
        CComPtr<IDebugProperty2>    prop;

        if ( assignExprText == NULL )
            return E_OUTOFMEMORY;

        hr = assignExprText.Append( L" = " );
        if ( FAILED( hr ) )
            return hr;

        hr = assignExprText.Append( pszValue );
        if ( FAILED( hr ) )
            return hr;

        hr = mExprContext->ParseText( assignExprText, 0, dwRadix, &expr, &errStr, &errPos );
        if ( FAILED( hr ) )
            return hr;

        hr = expr->EvaluateSync( 0, dwTimeout, NULL, &prop );
        if ( FAILED( hr ) )
            return hr;

        return S_OK;
    }
開發者ID:Stretto,項目名稱:mago,代碼行數:35,代碼來源:Property.cpp

示例8: StringFromXML

bool Skein::BoolFromXML(IXMLDOMNode* node, LPWSTR query, bool ifNon)
{
  CComBSTR text = StringFromXML(node,query);
  if (text.Length() > 0)
    return wcscmp(text.m_str,L"YES") == 0;
  return ifNon;
}
開發者ID:DavidKinder,項目名稱:Windows-Inform7,代碼行數:7,代碼來源:Skein.cpp

示例9: pt

char * CCoordTransService::CoordTransToStringEx (
	double dX, double dY, bool isX, char *pBuffer, int iLen)
{
	if (m_fIsInitialized) {
		try {
		CComBSTR bstr;
		CCSPoint pt (dX, dY);

			if (isX) {
				THROW_FAILED_HRESULT(m_CTF -> ToStrings (&pt, &bstr, NULL, NULL));
			} else {
				THROW_FAILED_HRESULT(m_CTF -> ToStrings (&pt, NULL, &bstr, NULL));
			}

			USES_CONVERSION;
			iLen = min(bstr.Length(), iLen-1);
			strncpy (pBuffer, OLE2A(bstr), iLen);
			pBuffer[iLen] = '\0';
			return pBuffer;

		} catch (_com_error &e) {
			ShowError (_COM_ERROR(e), IDS_CSSERRORCAPTION, g_cbCoordTransToStringEx);
			return NULL;
		}
	
	} 
	ShowError (TRIAS02_E_CSSNOTINITIALIZED, IDS_CSSERRORCAPTION, g_cbCoordTransToStringEx);
	return NULL;
}
開發者ID:hkaiser,項目名稱:TRiAS,代碼行數:29,代碼來源:CTFService.cpp

示例10: NodeExistsInParent

BOOL NodeExistsInParent(CComPtr<ItcProjectNode> owner_node, CComBSTR name) {
	_ASSERT( owner_node != NULL );

	if ((name.Length() > 0) && FAILED(name.ToLower()))
		return FALSE;
  
	CComPtr<ItcProjectNodeIterator> iterator;
    if (FAILED( owner_node->CreateChildIterator(&iterator) )) {
        return FALSE;
    }
	
    while (iterator->HasNext() == VARIANT_TRUE)  {
		CComPtr <ItcProjectNode> node;
		
        if (FAILED( iterator->Next(&node) )) {
            return FALSE;
        }
		
        CComBSTR caption;
		
        if (SUCCEEDED( node->get_Caption(&caption) )) {
            if ((caption.Length() == 0) || SUCCEEDED(caption.ToLower())) {
                if (caption == name) {
					return TRUE;
                }
            }
        }
	}

	return FALSE;
}
開發者ID:versionone,項目名稱:VersionOne.Integration.TestComplete,代碼行數:31,代碼來源:common.cpp

示例11: A2W

STDMETHODIMP CJoystickCtl::getProductName(BSTR *pName) {
	USES_CONVERSION;
	char* name = stick.getProductName();
	CComBSTR wName = A2W(name);
	*pName = wName.Detach();
	return S_OK;
}
開發者ID:09898,項目名稱:javascript-joystick,代碼行數:7,代碼來源:JoystickCtl.cpp

示例12: while

/////////////////////////////////////////////////////////////////////
// OPCBrowser::Item method
// Item index is 1-based for VB
STDMETHODIMP COPCBrowserImpl::Item( VARIANT ItemSpecifier, BSTR *pItem)
{
   if( ItemSpecifier.vt != VT_I4 && ItemSpecifier.vt != VT_I2 )
      return E_INVALIDARG;
   if( ItemSpecifier.vt == VT_I2 )
      ItemSpecifier.lVal = ItemSpecifier.iVal;
   if( ItemSpecifier.lVal < 1 || ItemSpecifier.lVal > m_names.size() )
      return E_INVALIDARG;
   if( pItem == NULL )
      return E_INVALIDARG;

   LONG index=1;
   m_listPosition = m_names.begin();
   while( m_listPosition!=m_names.end() && index < ItemSpecifier.lVal )
   {
      m_listPosition++;
      index++;
   }
   if( index == ItemSpecifier.lVal )
   {
      CComBSTR* pName = *m_listPosition;
      *pItem = pName->Copy();
      return S_OK;
   }

   return E_FAIL;
}
開發者ID:LM25TTD,項目名稱:ATCMcontrol_Engineering,代碼行數:30,代碼來源:OPCBrowser.cpp

示例13: GetFilter_new

HRESULT GetFilter_new(dimension_t dimension, short index, BSTR* filter)
{
    std::string szFG;
    std::string szFV;
    int  newIndex  = offset_to_new_index_(atFilter,dimension, index);

    XXGetFilterEx_(dimension, newIndex, &szFG, &szFV);

    CComBSTR bFilter;

//  ff::ignore_missing_arguments_scope  scoper;
//  fastformat::fmt(bFilter, "{0}{1}{2}{3}", szFG, winstl::w2m(strFilterSeparator), szFV);

#if 0
    fastformat::write(bFilter, szFG, winstl::w2m(strFilterSeparator), szFV); // +1

    *filter = bFilter.Detach();
#else /* ? 0 */

# if 1

    *filter = fastformat::write(bFilter, szFG, winstl::w2m(strFilterSeparator), szFV).Detach(); // +1

# else /* ? 0 */

    // This should not work, but does with some compilers ...

    *filter = fastformat::write(CComBSTR(), szFG, winstl::w2m(strFilterSeparator), szFV).Detach(); // +1

# endif /* 0 */

#endif /* 0 */

    return S_OK;
}
開發者ID:JerYme,項目名稱:fastformat,代碼行數:35,代碼來源:test.scratch.overload.3.BSTR_out_parameter.cpp

示例14: UacRestoreVolumeHeader

extern "C" int UacRestoreVolumeHeader (HWND hwndDlg, wchar_t *lpszVolume)
{
	CComPtr<ITrueCryptMainCom> tc;
	int r;

	CoInitialize (NULL);

	if (ComGetInstance (hwndDlg, &tc))
	{
		CComBSTR volumeBstr;
		BSTR bstr = W2BSTR(lpszVolume);
		if (bstr)
		{
			volumeBstr.Attach (bstr);
			r = tc->RestoreVolumeHeader ((LONG_PTR) hwndDlg, volumeBstr);
		}
		else
			r = ERR_OUTOFMEMORY;
	}
	else
		r = -1;

	CoUninitialize ();

	return r;
}
開發者ID:goofwear,項目名稱:VeraCrypt,代碼行數:26,代碼來源:MainCom.cpp

示例15: get_Fields

STDMETHODIMP CSimplePointDatasetHelper::FetchAll(long ClassIndex, BSTR WhereClause, VARIANT FieldMap, IPlugInCursorHelper **cursorHelper)
{
	HRESULT hr;
	if (! cursorHelper) return E_POINTER;

	// Some parameters can be ignored since,
  //   ClassIndex is only relevant to feature datasets
  //   WhereClause is not appropriate since we are not supporting SQL
  ISimplePointCursorHelperPtr ipSimplePointCursorHelper;
  hr = ipSimplePointCursorHelper.CreateInstance(CLSID_SimplePointCursorHelper);
  if (FAILED(hr)) return hr;

	hr = ipSimplePointCursorHelper->put_FieldMap(FieldMap);
	if (FAILED(hr)) return hr;

  IFieldsPtr ipFields;
	hr = get_Fields(0, &ipFields);
	if (FAILED(hr)) return hr;

	hr = ipSimplePointCursorHelper->putref_Fields(ipFields);
	if (FAILED(hr)) return hr;

	CComBSTR sFilePath;
	sFilePath = m_sWorkspacePath;
	sFilePath.Append(m_sDatasetName);
  hr = ipSimplePointCursorHelper->put_FilePath(sFilePath);
	if (FAILED(hr)) return hr;

  IPlugInCursorHelperPtr ipPlugInCursorHelper;
	ipPlugInCursorHelper = ipSimplePointCursorHelper;
	if (ipPlugInCursorHelper == NULL) return E_FAIL;

  *cursorHelper = ipPlugInCursorHelper.Detach(); // Pass ownership of object back to client
	return S_OK;
}
開發者ID:Aleksei-Iagur,項目名稱:arcobjects-sdk-community-samples,代碼行數:35,代碼來源:SimplePointDatasetHelper.cpp


注:本文中的CComBSTR類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。