Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.7 KiB

  1. /*++
  2. Microsoft Windows
  3. Copyright (C) Microsoft Corporation, 1981 - 1998
  4. Module Name:
  5. error.hxx
  6. Abstract:
  7. declarations of some very straightforward error reporting routines.
  8. Author:
  9. Rahul Thombre (RahulTh) 4/12/1998
  10. Revision History:
  11. 4/12/1998 RahulTh Created this module.
  12. 10/1/1998 RahulTh Modified the error reporting mechanism for
  13. better and easier error reporting
  14. --*/
  15. #ifndef __ERROR_HXX__
  16. #define __ERROR_HXX__
  17. #ifdef DBG
  18. #define DbgMsg(x) _DbgMsg x
  19. #else
  20. #define DbgMsg(x)
  21. #endif
  22. class CError
  23. {
  24. public:
  25. //constructor
  26. CError (CWnd* pParentWnd = NULL,
  27. UINT titleID = IDS_DEFAULT_ERROR_TITLE,
  28. DWORD dwWinErr = ERROR_SUCCESS,
  29. UINT nStyle = MB_OK | MB_ICONERROR)
  30. : m_hWndParent(pParentWnd?pParentWnd->m_hWnd:NULL),
  31. m_msgID (IDS_DEFAULT_ERROR),
  32. m_titleID (titleID),
  33. m_winErr (dwWinErr),
  34. m_nStyle (nStyle)
  35. {}
  36. int ShowMessage(UINT errID, ...);
  37. void SetError (DWORD dwWinError);
  38. int ShowConsoleMessage (LPCONSOLE pConsole, UINT errID, ...);
  39. void SetTitle (UINT titleID);
  40. void SetStyle (UINT nStyle);
  41. private:
  42. //data members
  43. HWND m_hWndParent; //pointer to the parent window
  44. UINT m_msgID; //resource id of the error message
  45. UINT m_titleID;//resource id of the title of the error message
  46. DWORD m_winErr; //win32 error code if any
  47. UINT m_nStyle; //the message box style to be displayed
  48. //helper functions
  49. void CError::ConstructMessage (va_list argList, CString& szErrMsg);
  50. };
  51. void _DbgMsg (LPCTSTR szFormat ...);
  52. #endif //__ERROR_HXX__