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.

171 lines
3.8 KiB

  1. // Copyright (c) 1997-1999 Microsoft Corporation
  2. //
  3. // Popup message box class
  4. //
  5. // 8-31-98 sburns
  6. #ifndef POPUP_HPP_INCLUDED
  7. #define POPUP_HPP_INCLUDED
  8. // Augments MessageBox with useful behavior
  9. class Popup
  10. {
  11. public:
  12. // Constuct an instance.
  13. //
  14. // titleStringResID - resource ID of the string to be used as the title
  15. // for all message dialogs raised by invoking methods of the instance.
  16. //
  17. // systemModal - true to indicate that message dialogs should have
  18. // system modal behavior
  19. explicit
  20. Popup(UINT titleStringResID, bool systemModal = false);
  21. // Constuct an instance.
  22. //
  23. // title - the string to be used as the title for all message dialogs
  24. // raised by invoking methods of the instance.
  25. //
  26. // systemModal - true to indicate that message dialogs should have
  27. // system modal behavior
  28. explicit
  29. Popup(const String& title, bool systemModal = false);
  30. // default dtor used.
  31. // Present a message box dialog, set input focus back to a given edit
  32. // box when the dialog is dismissed.
  33. //
  34. // parentDialog - the parent window containing the control to receive focus.
  35. //
  36. // editResID - Resource ID of the edit box to which focus will be set.
  37. //
  38. // messageStringResID - Resource ID of the message text to be shown in the
  39. // dialog. The title of the dialog is "Error".
  40. void
  41. Gripe(
  42. HWND parentDialog,
  43. int editResID,
  44. UINT messageStringResID);
  45. // Presents a message box dialog, set input focus back to a given edit
  46. // box when the dialog is dismissed.
  47. //
  48. // parentDialog - the parent window containing the control to receive focus.
  49. // editResID - Resource ID of the edit box to which focus will be set.
  50. //
  51. // message - Text to appear in the dialog.
  52. void
  53. Gripe(
  54. HWND parentDialog,
  55. int editResID,
  56. const String& message);
  57. // Presents a message box dialog, set input focus back to a given edit
  58. // box when the dialog is dismissed. The message is followed with the
  59. // description of the provided HRESULT.
  60. //
  61. // parentDialog - the parent window containing the control to receive focus.
  62. // editResID - Resource ID of the edit box to which focus will be set.
  63. //
  64. // hr - HRESULT indicating the error description text to appear after the
  65. // message text.
  66. //
  67. // message - Text to appear in the dialog. The title is "Error".
  68. void
  69. Gripe(
  70. HWND parentDialog,
  71. int editResID,
  72. HRESULT hr,
  73. const String& message);
  74. void
  75. Gripe(
  76. HWND parentDialog,
  77. int editResID,
  78. HRESULT hr,
  79. UINT messageStringResID);
  80. // variation on the theme that does not have an associated edit box.
  81. void
  82. Gripe(
  83. HWND parentDialog,
  84. const String& message);
  85. // Presents a message box
  86. void
  87. Error(
  88. HWND parentDialog,
  89. HRESULT hr,
  90. const String& message);
  91. void
  92. Error(
  93. HWND parentDialog,
  94. HRESULT hr,
  95. UINT messageStringResID);
  96. void
  97. Error(
  98. HWND parentDialog,
  99. UINT messageStringResID);
  100. void
  101. Error(
  102. HWND parentDialog,
  103. const String& message);
  104. void
  105. Info(
  106. HWND parentDialog,
  107. UINT messageStringResID);
  108. void
  109. Info(
  110. HWND parentDialog,
  111. const String& message);
  112. int
  113. MessageBox(
  114. HWND parentDialog,
  115. const String& message,
  116. UINT flags);
  117. int
  118. MessageBox(
  119. HWND parentDialog,
  120. UINT messageStringResID,
  121. UINT flags);
  122. private:
  123. void
  124. checkInit();
  125. UINT
  126. getStyleMask();
  127. bool initialized;
  128. bool systemModal;
  129. String title;
  130. UINT titleResId;
  131. };
  132. #endif // POPUP_HPP_INCLUDED