msgerr.hxx
Upload User: caisha3
Upload Date: 2013-09-21
Package Size: 208739k
Code Size: 2k
Category:

Windows Develop

Development Platform:

Visual C++

  1. /////////////////////////////////////////////////////////////////
  2. //  LASTERR.H
  3. //
  4. // Copyright 1986-1996 Microsoft Corporation. All Rights Reserved.
  5. //
  6. //
  7. // last err support object.
  8. //
  9. //There should be no global objects of this class
  10. // because by the time the dectructor of a global CLastError
  11. // is called, MAPIFreeBuffer does not work.
  12. #ifndef __LASTERR_H__
  13. #define __LASTERR_H__
  14. class CLastError
  15. {
  16. public:
  17.     ~CLastError(void);
  18.     HRESULT     Init(LPCTSTR szComponent);
  19.     // standard OLE or MAPI errors.
  20.     HRESULT     SetLastError(HRESULT hr);
  21.     // our internal extended error codes or a non-standard string for OLE or MAPI errors
  22.     // scFORM is one of the errors defined by MAKE_FOR_X_SCODE macro family
  23.     HRESULT     SetLastError(HRESULT hr, SCODE scFORM, ...);
  24.     // errors returned from underlying objects.
  25.     HRESULT     SetLastError(HRESULT hr, IUnknown* punk);
  26.     // our implementation of GetLastError
  27.     HRESULT     GetLastError(HRESULT hr, DWORD dwFlags,
  28.                                LPMAPIERROR * lppMAPIError);
  29.     
  30.     //displays the last error info
  31.     int         ShowError(HWND);
  32. private:
  33.     // we have three possible error types: our internal errors which
  34.     //  we signify by MAPI_E_EXTENDED to the user, standard errors
  35.     //  defined by MAPI and errors returned by objects we keep and utilize.
  36.     enum {eNoError, eExtended, eMAPI, eObject} _eLastErr;
  37.     HRESULT     _hrLast;
  38.     HRESULT     _hrGLE;  // what GetLastError on the object returned; mostly 0
  39.     LPMAPIERROR _pmapierr;
  40.     LPSTR       _szComponent;
  41. };
  42. #endif // __LASTERR_H__