Source code of Windows XP (NT5)
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.

136 lines
2.5 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994 - 1998.
  5. //
  6. // File: errordlg.hxx
  7. //
  8. // Contents: Class implementing a dialog used to display an error
  9. //
  10. // Classes: CMessageDlg
  11. //
  12. // History: 06-28-1998 DavidMun Created
  13. //
  14. //---------------------------------------------------------------------------
  15. #ifndef __ERRORDLG_HXX_
  16. #define __ERRORDLG_HXX_
  17. void
  18. PopupMessage(
  19. ULONG idsMessage,
  20. ...);
  21. void
  22. PopupMessageEx(
  23. PCWSTR idIcon,
  24. ULONG idsMessage,
  25. ...);
  26. void
  27. PopupMessageAndCode(
  28. PCWSTR pwzFileName,
  29. ULONG ulLineNo,
  30. HRESULT hr,
  31. ULONG idsMessage,
  32. ...);
  33. #define FILE_AND_LINE __THIS_FILE__, __LINE__
  34. #define MAX_ERROR_CODE (MAX_PATH + 30)
  35. //+--------------------------------------------------------------------------
  36. //
  37. // Class: CMessageDlg
  38. //
  39. // Purpose: Display an error dialog
  40. //
  41. // History: 06-28-1998 DavidMun Created
  42. //
  43. //---------------------------------------------------------------------------
  44. class CMessageDlg: public CDlg
  45. {
  46. public:
  47. CMessageDlg();
  48. virtual
  49. ~CMessageDlg();
  50. INT_PTR
  51. DoModalDialog(
  52. HINSTANCE hinstIcon,
  53. PCWSTR idIcon,
  54. PCWSTR pwzFile,
  55. ULONG ulLine,
  56. ULONG ulErrorCode,
  57. ULONG idsMessage,
  58. va_list valArgs);
  59. private:
  60. // *** CDlg overrides ***
  61. virtual HRESULT
  62. _OnInit(
  63. bool *pfSetFocus);
  64. virtual bool
  65. _OnCommand(
  66. WPARAM wParam,
  67. LPARAM lParam);
  68. // private member vars
  69. HINSTANCE m_hinstIcon;
  70. PCWSTR m_idIcon;
  71. PWSTR m_pwzMessage;
  72. WCHAR m_wzErrorCode[MAX_ERROR_CODE];
  73. };
  74. //+--------------------------------------------------------------------------
  75. //
  76. // Member: CMessageDlg::CMessageDlg
  77. //
  78. // Synopsis: ctor
  79. //
  80. // History: 06-28-1998 DavidMun Created
  81. //
  82. //---------------------------------------------------------------------------
  83. inline
  84. CMessageDlg::CMessageDlg():
  85. m_hinstIcon(NULL),
  86. m_idIcon(IDI_ERROR),
  87. m_pwzMessage(NULL)
  88. {
  89. m_wzErrorCode[0] = L'\0';
  90. }
  91. //+--------------------------------------------------------------------------
  92. //
  93. // Member: CMessageDlg::~CMessageDlg
  94. //
  95. // Synopsis: dtor
  96. //
  97. // History: 06-28-1998 DavidMun Created
  98. //
  99. //---------------------------------------------------------------------------
  100. inline
  101. CMessageDlg::~CMessageDlg()
  102. {
  103. delete [] m_pwzMessage;
  104. }
  105. #endif // __ERRORDLG_HXX_