CComBSTR::operator !
Checks whether BSTR string is NULL.
bool operator !( ) const throw( );
Return Value
Returns true if the m_str member is NULL; otherwise, false.
Remarks
This operator only checks for a NULL value, not for an empty string.
Example
// STDMETHOD(BSTRToUpper)(/*[in, out]*/ BSTR bstrConv);
STDMETHODIMP InplaceBSTRToUpper(BSTR bstrConv)
{
// Assign bstrConv to m_str member of CComBSTR
CComBSTR bstrTemp;
bstrTemp.Attach(bstrConv);
// Make sure BSTR is not NULL string
if (!bstrTemp)
return E_POINTER;
// Make string uppercase
HRESULT hr;
hr = bstrTemp.ToUpper();
if (hr != S_OK)
return hr;
// Set m_str to NULL, so the BSTR is not freed
bstrTemp.Detach();
return S_OK;
}
Requirements
Header: atlcomcli.h