COMExceptionBase Struct Reference

COM ExceptionBase class as replacement for _com_error. More...

#include <comutil.h>

Inheritance diagram for COMExceptionBase:

Inheritance graph
[legend]
Collaboration diagram for COMExceptionBase:

Collaboration graph
[legend]

Public Member Functions

 COMExceptionBase (HRESULT hr)
HRESULT Error () const
LPCTSTR ErrorMessage () const

Protected Attributes

HRESULT _hr
String _msg

Detailed Description

COM ExceptionBase class as replacement for _com_error.

Definition at line 58 of file comutil.h.


Constructor & Destructor Documentation

COMExceptionBase::COMExceptionBase ( HRESULT  hr  )  [inline]

Definition at line 60 of file comutil.h.

00061      :  _hr(hr)
00062     {
00063     }


Member Function Documentation

HRESULT COMExceptionBase::Error (  )  const [inline]

Definition at line 65 of file comutil.h.

References _hr.

00066     {
00067         return _hr;
00068     }

LPCTSTR COMExceptionBase::ErrorMessage (  )  const [inline]

Definition at line 70 of file comutil.h.

References _hr, _msg, and _stprintf.

00071     {
00072         if (_msg.empty()) {
00073             LPTSTR pBuf;
00074 
00075             if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
00076                 0, _hr, MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT), (LPTSTR)&pBuf, 0, NULL)) {
00077                 _msg = pBuf;
00078                 LocalFree(pBuf);
00079              } else {
00080                 TCHAR buffer[128];
00081                 _stprintf(buffer, TEXT("unknown Exception: 0x%08lX"), _hr);
00082                 _msg = buffer;
00083              }
00084         }
00085 
00086         return _msg;
00087     }


Field Documentation

HRESULT COMExceptionBase::_hr [protected]

Definition at line 90 of file comutil.h.

Referenced by Error(), and ErrorMessage().

String COMExceptionBase::_msg [mutable, protected]

Definition at line 91 of file comutil.h.

Referenced by ErrorMessage().


The documentation for this struct was generated from the following file:
IBrowser Source Code Documentation
generated on 18.09.2008 by doxygen

Homepage