This documentation is archived and is not being maintained.

CComBSTR::CopyTo 

Allocates and returns a copy of m_str via the parameter.


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

Parameters

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.

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