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


C++ CString::AllocSysString方法代码示例

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


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

示例1: OnDocumentComplete

	void OnDocumentComplete(LPDISPATCH pDisp, LPCTSTR szUrl) {
		CString str;

		str = _T("<b>Internal:</b><br>");
		for (int i = 0; i < 0x14; ++i) {
			if ((i & 3) == 0)
				str.AppendFormat(_T("<tt>$%X: </tt>"), i + 0x4000);
			
			str.Append(_T("<tt style=\"color:green\">"));
			str.AppendFormat(_T("$%02X "), m_pInternalRegs->R_2A03[i]);
			str.Append(_T("</tt>"));

			str.Append((i & 3) == 3 ? _T("<br>") : _T(""));
		}
		if (m_iChip & SNDCHIP_VRC6) {
			str.Append(_T("<br>"));
			for (int i = 0; i < 9; ++i) {
				if ((i % 3) == 0)
					str.AppendFormat(_T("<tt>$%X: </tt>"), (i / 3) * 0x1000 + 0x9000);
				str.Append(_T("<tt style=\"color:green\">"));
				str.AppendFormat(_T("$%02X "), m_pInternalRegs->R_VRC6[i]);
				str.Append(_T("</tt>"));

				str.Append((i % 3) == 2 ? _T("<br>") : _T(""));
			}
		}

		SetElementHtml(_T("resultInternal"), str.AllocSysString());

		str = _T("<b>Exported:</b><br>");
		for (int i = 0; i < 0x14; ++i) {
			if ((i & 3) == 0)
				str.AppendFormat(_T("<tt>$%X: </tt>"), i + 0x4000);

			str.AppendFormat(_T("<tt style=\"color:%s\">"), (m_pExternalRegs->R_2A03[i] == m_pInternalRegs->R_2A03[i]) ? _T("green") : _T("red"));
			str.AppendFormat("$%02X ", m_pExternalRegs->R_2A03[i]);
			str.Append(_T("</tt>"));

			str.AppendFormat((i & 3) == 3 ? _T("<br>") : _T(""));
		}
		if (m_iChip & SNDCHIP_VRC6) {
			str.Append(_T("<br>"));
			for (int i = 0; i < 9; ++i) {
				if ((i % 3) == 0)
					str.AppendFormat(_T("<tt>$%X: </tt>"), (i / 3) * 0x1000 + 0x9000);

				str.AppendFormat(_T("<tt style=\"color:%s\">"), (m_pExternalRegs->R_VRC6[i] == m_pInternalRegs->R_VRC6[i]) ? _T("green") : _T("red"));
				str.AppendFormat(_T("$%02X "), m_pExternalRegs->R_VRC6[i]);
				str.Append(_T("</tt>"));

				str.Append((i % 3) == 2 ? _T("<br>") : _T(""));
			}
		}

		SetElementHtml(_T("resultExternal"), str.AllocSysString());

		str.Format(_T("APU frames since last row: %i<br><br>"), m_iUpdateFrames);
		str.AppendFormat(_T("File size: %i kB"), m_iFileSize / 1024);
		SetElementHtml(_T("other"), str.AllocSysString());
	}
开发者ID:BattyBovine,项目名称:UmaTracker,代码行数:60,代码来源:ExportTest.cpp

示例2: GetMemberName

//----------------------------------------------------------------------------
//  GetMemberName
HRESULT CDispExIdManager::GetMemberName(
  DISPID  id,
  BSTR  * pbstrName)
{
  ENSURE_RETVAL(pbstrName);
  CString sName;
#ifdef CDispExIdManager_USE_REVERSELOOKUPMAP
  if (m_Names.Lookup(id, sName))
  {
    (*pbstrName) = sName.AllocSysString();
    return S_OK;
  }
#else
  DISPID dispid;

  POSITION pos = m_IDs.GetStartPosition();
  while(pos)
  {
    m_IDs.GetNextAssoc(pos, sName, dispid);
    if (dispid == id)
    {
      (*pbstrName) = sName.AllocSysString();
      return S_OK;
    }
  }
#endif
  return DISP_E_UNKNOWNNAME;
}
开发者ID:ondravondra,项目名称:adobo-ie,代码行数:30,代码来源:DispExIdManager.cpp

示例3: SingleReport

void CLryEDBQryView::SingleReport(CReportSele *pDlg)
{
	_variant_t str;
	int nItemIndex;
	CLryEDBQryDoc* pDoc = GetDocument();
	if(( nItemIndex=GetListCtrl().GetNextItem(-1,LVNI_SELECTED))!=-1)
	{
		pDoc->Rs->Move(nItemIndex,(long)adBookmarkFirst);
		str = pDoc->Rs->GetCollect(_bstr_t("试验编号")); 		 
		CString	strSQL;
		strSQL.Format(_T("select * from 热容量 where  试验编号='%s'"),VariantToStr(str)); 		
		try
		{ 
			
			HRESULT hr; 
			
			if(pDoc->RsPrintData->State==adStateOpen)
				pDoc->RsPrintData->Close();			
			hr = pDoc->RsPrintData->Open(strSQL.AllocSysString(),
				theApp.pConn.GetInterfacePtr(),
				adOpenStatic,
				adLockOptimistic,
				-1);
			TESTHR(hr); 
			
			if(pDoc->RsTitle->State==adStateOpen)
				pDoc->RsTitle->Close();
			strSQL = _T("select * from 系统参数");
			hr = GetDocument()->RsTitle->Open(strSQL.AllocSysString(),
				theApp.pConn.GetInterfacePtr(),
				adOpenStatic,
				adLockOptimistic,
				-1);
			TESTHR(hr); 
			
			pReportdlg.Init(0);
			pReportdlg.SetModifyPrepared(TRUE);	
			LPCTSTR dbName2 = _T("CopyHeat");
			pReportdlg.AddAdoDataSet(dbName2,((CLryEDBQryDoc*)GetDocument())->RsTitle);
			pReportdlg.SetModifyPrepared(TRUE);
			LPCTSTR dbName1  = _T("SReportHeat");
			pReportdlg.AddAdoDataSet(dbName1,((CLryEDBQryDoc*)GetDocument())->RsPrintData);
			//nItemIndex = pDoc->RsPrintData->GetRecordCount();	
			//pDoc->RsPrintData->MoveFirst();
			CString File(pDlg->cPath);
			File+=_T("reports\\")+pDlg->cFile;
			LPCTSTR path = File.GetBuffer(File.GetLength());
			pReportdlg.SetReportFile(path);
			File.ReleaseBuffer();
			if(pDlg->m_iSelect==0)
				pReportdlg.ShowReport();       //设计报表 
			else
				pReportdlg.DesignReport();		// 预览报表 
		}
		catch(_com_error &e)
		{ 
			dump_com_error(e);
		} 
	}	
}
开发者ID:eseawind,项目名称:CoalQualityTestSystem,代码行数:60,代码来源:LryEDBQryView.cpp

示例4: get_accName

//****************************************************************************
HRESULT CBCGPToolBoxPage::get_accName(VARIANT varChild, BSTR *pszName)
{
	if (varChild.vt == VT_I4)
	{
		if (varChild.lVal == CHILDID_SELF)
		{
			CString strText = _T("Toolbox Page");

			if (GetSafeHwnd() != NULL)
			{
				GetWindowText(strText);
			}

			*pszName = strText.AllocSysString();
			return S_OK;
		}
		else
		{
			CBCGPToolBoxButton* pButton = GetAccChild(varChild.lVal);
			if (pButton != NULL)
			{
				CString strName = pButton->m_strLabel;
				*pszName = strName.AllocSysString();

				return S_OK;
			}
		}
	}

	return S_FALSE;
}
开发者ID:cugxiangzhenwei,项目名称:WorkPlatForm,代码行数:32,代码来源:BCGPToolBox.cpp

示例5: OnLoadDir

/**
* OnLoadDir
*
* Description: 
*/
LRESULT CMainFrame::OnLoadDir(WPARAM wParam, LPARAM lParam)
{
	CConnectionListView * connectionView = (CConnectionListView *)m_mainSplitter.GetPane(0,0);
	CFileListView * fileListView = (CFileListView *)m_mainSplitter.GetPane(0,1);

	CString * dirArg = (CString*)lParam;
	if(dirArg){
		TRACE1(" Load dir: %s \n", dirArg->AllocSysString());
		CString dir(dirArg->AllocSysString());

		// Load file list view
		//fileListView->LoadServerConnection(connection_id);
		fileListView->LoadDirectory(dir);

		// Load url in header history.
		if(m_headerDoc && ((int)wParam) == 1){
			m_headerDoc.SetUrl( CString( fileListView->m_connection->host + dir) );
			//m_headerDoc.SetConnectionID(connection_id); 
			m_headerDoc.m_path = CString(dir);          // This needs work
			CFileListView * v = (CFileListView *)m_mainSplitter.GetPane(0,1);
			m_headerDoc.m_path = CString(v->GetPath());
		}

		// Cleanup
		delete dirArg;
	}
	return 1;
}
开发者ID:Omgan,项目名称:RealFTP.net,代码行数:33,代码来源:MainFrm.cpp

示例6: CoCreateInstance

CHttpRequest::CHttpRequest(const CString& url)
: m_pIXMLHttpRequest(NULL)
, m_state(HTTP_CLOSED)
{
    HRESULT hr;
    //hr = CoInitialize(NULL); 

    // Create XMLHttpRequest object and initialize m_pIXMLHttpRequest.
    hr = CoCreateInstance(CLSID_XMLHTTPRequest, NULL, CLSCTX_INPROC, 
        IID_IXMLHttpRequest, (void **)&m_pIXMLHttpRequest);

    if(FAILED(hr))
        return;

    VARIANT vAsync;
    vAsync.vt = VT_BOOL;
    vAsync.boolVal = VARIANT_TRUE;

    VARIANT vUser;
    vUser.vt = VT_BSTR;
    vUser.bstrVal = NULL;

    VARIANT vPassword;
    vPassword.vt = VT_BSTR;
    vPassword.bstrVal = NULL;

    BSTR str = url.AllocSysString();
    hr = m_pIXMLHttpRequest->open(_T("POST"), str, vAsync, vUser, vPassword);
    ASSERT(hr == S_OK);
}
开发者ID:beqabeqa473,项目名称:TeamTalk5,代码行数:30,代码来源:HttpRequest.cpp

示例7: InitItem

BOOL CWizardBasedProjectTemplateItem::InitItem(LPCTSTR lpszPath, CImageList &ImageList32, CImageList &ImageList16)
{
	m_strPath = lpszPath;

	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	// retrieve the wizard interface
	CString strProgId;
	strProgId.Format(_T("%s.ProjectWizard"), CPathTool::GetFileTitle(m_strPath));

	BSTR bstrProgId = strProgId.AllocSysString();
	HRESULT result = m_wizard.CoCreateInstance(bstrProgId, NULL, CLSCTX_INPROC_SERVER);

	if (result != S_OK)
		return FALSE;

	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	// get the icon
	HICON hIcon = NULL;

	int nIconIndex = m_wizard.GetIconIndex();
	if (nIconIndex >= 0)
		hIcon = ExtractIcon(AfxGetInstanceHandle(), m_strPath, nIconIndex);
	if (!hIcon)
		hIcon = theApp.LoadIcon(IDR_LATEXWIZARD);

	m_nImageIndex = ImageList32.Add(hIcon);
	ImageList16.Add(hIcon);

	return TRUE;
}
开发者ID:bzindovic,项目名称:texniccenter-code,代码行数:30,代码来源:projectnewdialog.cpp

示例8: GetElementById

HRESULT GetElementById(IHTMLDocument2 *pDoc, CString szId, IHTMLElement** pElem)
{
    *pElem = NULL;
    HRESULT hr = S_OK;

    BSTR bstrID = szId.AllocSysString();
    VARIANT varName, varIndex;
    varName.vt = VT_BSTR;
    varName.bstrVal = bstrID;
    varIndex.vt = VT_I4;
    varIndex.intVal = 0;        

    IHTMLElementCollection *pColl;
    hr = pDoc->get_all(&pColl);

    if (hr == S_OK && pColl)
    {
        IDispatch* pDisp;
        hr = pColl->item(varName, varIndex, &pDisp);
        if (hr == S_OK && pDisp)
        {
            hr = pDisp->QueryInterface(IID_IHTMLElement, (void**)pElem);
        }
    }
    
    ::SysFreeString(bstrID);

    return hr;
}
开发者ID:haokeyy,项目名称:fahister,代码行数:29,代码来源:DHtmlHelper.cpp

示例9: SetPictureHight

void CPictureProperty::SetPictureHight(CString pictureHight)
{
	CMFCPropertyGridProperty* this1=this->GetSubItem(1);
	COleVariant oleVar=this1->GetValue();
	oleVar.bstrVal=pictureHight.AllocSysString();
	this1->SetValue(oleVar);
}
开发者ID:kooyou,项目名称:EBE,代码行数:7,代码来源:PictureProperty.cpp

示例10: GetStandardProp

void CCmdTarget::GetStandardProp(const AFX_DISPMAP_ENTRY* pEntry,
	VARIANT* pvarResult, UINT* puArgErr)
{
	ASSERT(pEntry != NULL);
	ASSERT(*puArgErr != 0);

	// it is a DISPATCH_PROPERTYGET (for standard, non-function property)
	void* pProp = (BYTE*)this + pEntry->nPropOffset;
	if (pEntry->vt != VT_VARIANT)
		pvarResult->vt = pEntry->vt;
	switch (pEntry->vt)
	{
	case VT_I1:
		pvarResult->bVal = *(BYTE*)pProp;
		break;
	case VT_I2:
		pvarResult->iVal = *(short*)pProp;
		break;
	case VT_I4:
		pvarResult->lVal = *(long*)pProp;
		break;
	case VT_R4:
		pvarResult->fltVal = *(float*)pProp;
		break;
	case VT_R8:
		pvarResult->dblVal = *(double*)pProp;
		break;
	case VT_DATE:
		pvarResult->date = *(double*)pProp;
		break;
	case VT_CY:
		pvarResult->cyVal = *(CY*)pProp;
		break;
	case VT_BSTR:
		{
			CString* pString = (CString*)pProp;
			pvarResult->bstrVal = pString->AllocSysString();
		}
		break;
	case VT_ERROR:
		pvarResult->scode = *(SCODE*)pProp;
		break;
	case VT_BOOL:
		V_BOOL(pvarResult) = (VARIANT_BOOL)(*(BOOL*)pProp != 0 ? -1 : 0);
		break;
	case VT_VARIANT:
		if (VariantCopy(pvarResult, (LPVARIANT)pProp) != S_OK)
			*puArgErr = 0;
		break;
	case VT_DISPATCH:
	case VT_UNKNOWN:
		pvarResult->punkVal = *(LPDISPATCH*)pProp;
		if (pvarResult->punkVal != NULL)
			pvarResult->punkVal->AddRef();
		break;

	default:
		*puArgErr = 0;
	}
}
开发者ID:anyue100,项目名称:winscp,代码行数:60,代码来源:oledisp1.cpp

示例11: SetValue

BOOL CADOParameter::SetValue(CString strValue)
{
	_variant_t vtVal;

	ASSERT(m_pParameter != NULL);
	
	if(!strValue.IsEmpty())
		vtVal.vt = VT_BSTR;
	else
		vtVal.vt = VT_NULL;

	//Corrected by Giles Forster 10/03/2001
	vtVal.bstrVal = strValue.AllocSysString();
	//vtVal.SetString(strValue.GetBuffer(0));

	try
	{
		if(m_pParameter->Size == 0)
			m_pParameter->Size = sizeof(char) * strValue.GetLength();

		m_pParameter->Value = vtVal;
		::SysFreeString(vtVal.bstrVal);
		return TRUE;
	}
	catch(_com_error &e)
	{
		dump_com_error(e);
		::SysFreeString(vtVal.bstrVal);
		return FALSE;
	}
}
开发者ID:zxlooong,项目名称:minica,代码行数:31,代码来源:ado2.cpp

示例12: GetFunctionName

    HRESULT StackFrame::GetFunctionName( 
        FRAMEINFO_FLAGS flags, 
        UINT radix, 
        BSTR* funcName )
    {
        _ASSERT( funcName != NULL );
        HRESULT hr = S_OK;
        CString fullName;

        if ( (flags & FIF_FUNCNAME_MODULE) != 0 )
        {
            if ( mModule != NULL )
            {
                CComBSTR modNameBstr;
                mModule->GetName( modNameBstr );
                fullName.Append( modNameBstr );
                fullName.AppendChar( L'!' );
            }
        }

        hr = AppendFunctionNameWithSymbols( flags, radix, fullName );
        if ( FAILED( hr ) )
        {
            hr = AppendFunctionNameWithAddress( flags, radix, fullName );
            if ( FAILED( hr ) )
                return hr;
        }

        *funcName = fullName.AllocSysString();

        return hr;
    }
开发者ID:aBothe,项目名称:MagoWrapper,代码行数:32,代码来源:StackFrame.cpp

示例13: AddNamedItems

HRESULT CScriptManager::AddNamedItems( IActiveScript* pScript )
{
   HRESULT hResult;
   POSITION posNamedItem;
   IDispatch* pDispatch;
   CString strItemName;
   BSTR bstrItemName;

   ENSURE( pScript != NULL );

   hResult = pScript->AddNamedItem( L"TCForm", SCRIPTITEM_ISVISIBLE|
	  SCRIPTITEM_ISSOURCE );
   if( FAILED( hResult ) )
   {
	  return( hResult );
   }

   posNamedItem = m_mapNamedItems.GetStartPosition();
   while( posNamedItem != NULL )
   {
	  m_mapNamedItems.GetNextAssoc( posNamedItem, strItemName, pDispatch );
	  bstrItemName = strItemName.AllocSysString();
	  hResult = pScript->AddNamedItem( bstrItemName, SCRIPTITEM_ISVISIBLE|
		 SCRIPTITEM_ISSOURCE );
	  SysFreeString( bstrItemName );
	  if( FAILED( hResult ) )
	  {
		 return( hResult );
	  }
   }

   return( S_OK );
}
开发者ID:jetlive,项目名称:skiaming,代码行数:33,代码来源:ScrMngr.Cpp

示例14:

HRESULT	  ColumnProvider::FBInfo::GetVariant(const CString& str,VARIANT *vt) {
  if (V_BSTR(vt)=str.AllocSysString()) {
    V_VT(vt)=VT_BSTR;
    return S_OK;
  }
  return E_OUTOFMEMORY;
}
开发者ID:Nekkit-L,项目名称:fictionbookeditor,代码行数:7,代码来源:ColumnProvider.cpp

示例15: WriteNodeAttribute

bool XmlIOStreamImp::WriteNodeAttribute(const CString& attrName, const CString& attrValue)
{
	DATA_ASSERT(!mbIsRead);
	if(mbIsRead)
		return false; // Can't write to the read stream.

	DATA_ASSERT(mpCurrentNode != NULL);
	if(NULL == mpCurrentNode)
		return false;

	MSXML2::IXMLDOMDocumentPtr xmlDocument = mpCurrentNode->GetownerDocument();
	if (xmlDocument)
	{
		// Create attribute node
		MSXML2::IXMLDOMAttributePtr attr = xmlDocument->createAttribute((LPCTSTR)attrName);

		VARIANT va;
		va.vt=VT_BSTR;
		va.bstrVal = attrValue.AllocSysString();
		attr->put_value(va);

		mpCurrentNode->attributes->setNamedItem(attr);

		VariantClear(&va);

		return true;
	}

	return false;
}
开发者ID:JeffreyZksun,项目名称:pcassist,代码行数:30,代码来源:XmlIOStreamImp.cpp


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