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


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

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


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

示例1: CreateStringFromStream

// die folgende Funktion ist das konkrete äquivalent für 'OleLoadFromStream' --
HRESULT CreateStringFromStream (IStream *pIStream, LPSTR lpstr, int iLen)
{
    ASSERT(pIStream);
    ASSERT(lpstr);
    ASSERT(0 < iLen);
    if (NULL == lpstr) return E_POINTER;
    if (0 == iLen) return E_INVALIDARG;

    USES_CONVERSION;

    *lpstr = '\0';

    try 
    {	// Variant liest sich selbst vom Stream
        CComVariant cv;// VariantInit()
        HRESULT hr = cv.ReadFromStream (pIStream);  
        if (FAILED(hr)) _com_issue_error(hr);
        // Richtigen Typ rausholen
        hr = cv.ChangeType (VT_BSTR);
        if (FAILED(hr)) _com_issue_error(hr);
        // Wert lesen
        CComBSTR bstr = cv.bstrVal; // SysAllocString(...
        LPSTR lpstrName = OLE2A(bstr.m_str);
        if (iLen < strlen(lpstrName)) _com_issue_error(E_INVALIDARG); 
        strcpy(lpstr, lpstrName);
        // in ~CComVariant() VariantClear()
    } // in ~CComBSTR() SysFreeString(m_str)
    catch (_com_error& e) 
    {
        return _COM_ERROR(e);
    }

    return NOERROR;
}
开发者ID:hkaiser,项目名称:TRiAS,代码行数:35,代码来源:Datahelp.cpp

示例2: Load

HRESULT CControlState::Load( LPSTREAM pStm )
{
   HRESULT hr = S_OK;
   CComVariant var;

   DWORD dwVer;
   READDATA( dwVer );

   // version 1 and 2 are pre-2.0 and are not backward compatible.  Ignore this data.
   if ( dwVer < 3 )
   {
      return S_FALSE;
   }

   READDATA( m_bColorSyntax );
   READDATA( m_bAllowHSplit );
   READDATA( m_bAllowVSplit );
   READDATA( m_bHScroll );
   READDATA( m_bVScroll );
   READDATA( m_bSmoothScroll );
   READDATA( m_bLineToolTips );
   READDATA( m_bShowLeftMargin );
   READDATA( m_bAllowColumnSel );
   READDATA( m_bAllowDragDrop );
   READDATA( m_bExpandTabs );
   READDATA( m_xPosHSplitter );
   READDATA( m_yPosVSplitter );
   READDATA( m_eIndentStyle );
   READDATA( m_nTabSize );
   READDATA( m_Colors );
   READDATA( m_lf );

   // dealloc old strings
   FreeStrings();

   if ( SUCCEEDED( hr = var.ReadFromStream( pStm ) ) )
   {
       m_bstrText = var.bstrVal;
       var.bstrVal = NULL;
       var.vt = VT_EMPTY;
   }
   else
      goto bail;

   if ( SUCCEEDED( hr = var.ReadFromStream( pStm ) ) )
   {
       m_bstrLang = var.bstrVal;
       var.bstrVal = NULL;
       var.vt = VT_EMPTY;
   }
   else
      goto bail;

   READDATA( m_bDisplayWhitespace );
   READDATA( m_bWantCarriageReturn );
   READDATA( m_bEnabled );
   READDATA( m_bGlobalProps );
   READDATA( m_bModified );
   READDATA( m_bOverType );
   READDATA( m_bReadOnly );
   READDATA( m_bPreserveCase );
   READDATA( m_bCaseSensitiveSearch );
   READDATA( m_bWholeWordOnly );
   READDATA( m_nMaxUndo );
   READDATA( m_bSelBounds );
   READDATA( m_bRegExp );
   READDATA( m_FontStyles );
   READDATA( m_LineNum );
   READDATA( m_bHideSel );
   READDATA( m_bNormalizeCase );
   READDATA( m_bOvertypeCaret );
   READDATA( m_nHighlightedLine );

   if ( dwVer < 4 )
      goto bail;

   READDATA( m_dwBorderStyle );

   if ( dwVer < 5 )
      goto bail;

   READDATA( m_bStealKeys );

   bail:

   return hr;
}
开发者ID:DeegC,项目名称:ZeidonTools,代码行数:87,代码来源:ctlstate.cpp


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