CComBSTR::CopyTo

将参数分配并返回 m_str 的副本。

HRESULT CopyTo( 
   BSTR* pbstr  
) throw( ); 
HRESULT CopyTo( 
   VARIANT* pvarDest  
) throw( );

参数

  • pbstr
    [in]返回该字符串的方法分配 BSTR 的地址。

  • pvarDest
    [in]返回该字符串的方法分配 VARIANT 的地址。

返回值

指示复制的成功或失败标准 HRESULT 值。

备注

在调用此方法后,VARIANT 指向由 pvarDest 将为类型 VT_BSTR

示例

CComBSTR m_bstrURL; // BSTR representing a URL 

// get_URL is the get method for the URL property. 
STDMETHOD(get_URL)(BSTR* pstrURL)
{
   // Make a copy of m_bstrURL and return it via pstrURL 
   return m_bstrURL.CopyTo(pstrURL);
}

要求

Header: atlbase.h

请参见

参考

CComBSTR 类

CComBSTR::Copy

CComBSTR::operator =