CComBSTR::operator!

Überprüft, ob BSTR Zeichenfolge NULL ist.

bool operator !( ) const throw( );

Rückgabewert

Gibt true zurück, wenn der m_str-Member NULL ist; andernfalls false.

Hinweise

Überprüfungen dieses Operators nur für einen NULL-Wert, nicht für eine leere Zeichenfolge.

Beispiel

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

Anforderungen

Header: atlbase.h

Siehe auch

Referenz

CComBSTR-Klasse