Freigeben über


CComBSTR::operator +=

Appends a string to the CComBSTR object.

CComBSTR& operator +=(
   const CComBSTR& bstrSrc 
);
CComBSTR& operator +=(
   const LPCOLESTR pszSrc 
);

Parameters

  • bstrSrc
    [in] A CComBSTR object to append.

  • pszSrc
    [in] A zero-terminated string to append.

Remarks

CComBSTRs are compared textually in the context of the user's default locale. The LPCOLESTR comparison is done using memcmp on the raw data in each string. The LPCSTR comparison is carried out in the same way once a temporary Unicode copy of pszSrc has been created. The final comparison operator just compares the contained string against NULL.

Example

CComBSTR bstrPre(OLESTR("Hello "));
CComBSTR bstrSuf(OLESTR("World!"));

// Appends "World!" to "Hello "
bstrPre += bstrSuf;

// Displays a message box with text "Hello World!"
::MessageBox(NULL, CW2CT(bstrPre), NULL, MB_OK);   

Requirements

Header: atlcomcli.h

See Also

Concepts

CComBSTR Class

CComBSTR Members

CComBSTR::Append

CComBSTR::AppendBSTR

ATL and MFC String Conversion Macros