CComBSTR::Append

Aggiunge lpsz o BSTRbstrSrc a m_str.

HRESULT Append(
   const CComBSTR& bstrSrc 
) throw( );
HRESULT Append(
   wchar_t ch
) throw( );
HRESULT Append(
   char ch
) throw( );
HRESULT Append(
   LPCOLESTR lpsz 
) throw( );
HRESULT Append(
   LPCSTR lpsz 
) throw( );
HRESULT Append(
   LPCOLESTR lpsz,
   int nLen 
) throw( );

Parametri

  • bstrSrc
    [in] oggetto A CComBSTR da aggiungere.

  • de-ch
    [in] carattere che da aggiungere.

  • lpsz
    [in] A zero è terminata la stringa di caratteri da aggiungere.È possibile passare una stringa Unicode tramite overload LPCOLESTR o stringa ANSI utilizzando la versione LPCSTR.

  • nLen
    [in] numero di caratteri da lpsz da aggiungere.

Valore restituito

S_OK su positivo, o qualsiasi valore di errore standard HRESULT.

Note

Una stringa ANSI viene convertita in Unicode prima di essere aggiunto.

Esempio

enum { urlASP, urlHTM, urlISAPI } urlType;
urlType = urlASP;

CComBSTR bstrURL = OLESTR("http://SomeSite/");
CComBSTR bstrDEF = OLESTR("/OtherSite");
CComBSTR bstrASP = OLESTR("default.asp");

CComBSTR bstrTemp;
HRESULT hr;

switch (urlType)
{
case urlASP:
   // bstrURL is 'http://SomeSite/default.asp'
   hr = bstrURL.Append(bstrASP);
   break;

case urlHTM:
   // bstrURL is 'http://SomeSite/default.htm'
   hr = bstrURL.Append(OLESTR("default.htm"));
   break;

case urlISAPI:
   // bstrURL is 'http://SomeSite/default.dll?func'
   hr = bstrURL.Append(OLESTR("default.dll?func"));
   break;

default:
   // bstrTemp is 'http://'
   hr = bstrTemp.Append(bstrURL, 7);
   // bstrURL is 'http://OtherSite'
   if (hr == S_OK)
       hr = bstrTemp.Append(bstrDEF);
   bstrURL = bstrTemp;

   break;
}

Requisiti

Header: atlbase.h

Vedere anche

Riferimenti

CComBSTR (classe)

CComBSTR::AppendBSTR

CComBSTR::operator +=