CComBSTR::operator !
Проверяет, является ли строка BSTR значение null.
bool operator !( ) const throw( );
Возвращаемое значение
Возвращает true если элемент m_strNULL; в противном случае – значение false.
Заметки
Этот оператор проверяет только значения Null, а не для пустой строки.
Пример
// 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;
}
Требования
Header: atlbase.h