Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CComBSTR::CopyTo

 

Allocates and returns a copy of m_str via the parameter.


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

pbstr

[out] The address of a BSTR in which to return the string allocated by this method.

pvarDest

[out] The address of a VARIANT in which to return the string allocated by this method.

A standard HRESULT value indicating the success or failure of the copy.

After calling this method, the VARIANT pointed to by pvarDest will be of type VT_BSTR.

Example

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);
}

Requirements

Header: atlbase.h

Show: