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.

143 lines
4.2 KiB

  1. /*******************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORPORATION, 2000
  4. *
  5. * TITLE: MBOXEX.H
  6. *
  7. * VERSION: 1.0
  8. *
  9. * AUTHOR: ShaunIv
  10. *
  11. * DATE: 7/13/2000
  12. *
  13. * DESCRIPTION: Super duper message box
  14. *
  15. *******************************************************************************/
  16. #ifndef __MBOXEX_H_INCLUDED
  17. #define __MBOXEX_H_INCLUDED
  18. #include <windows.h>
  19. #include <simstr.h>
  20. class CMessageBoxEx
  21. {
  22. public:
  23. enum
  24. {
  25. //
  26. // Greatest number of buttons allowed
  27. //
  28. MaxButtons = 4
  29. };
  30. enum
  31. {
  32. //
  33. // Button formats
  34. //
  35. MBEX_OK = 0x00000000,
  36. MBEX_OKCANCEL = 0x00000001,
  37. MBEX_YESNO = 0x00000002,
  38. MBEX_CANCELRETRY = 0x00000010,
  39. MBEX_CANCELRETRYSKIPSKIPALL = 0x00000020,
  40. MBEX_YESYESTOALLNONOTOALL = 0x00000040,
  41. //
  42. // Default button flags
  43. //
  44. MBEX_DEFBUTTON1 = 0x00000000,
  45. MBEX_DEFBUTTON2 = 0x00100000,
  46. MBEX_DEFBUTTON3 = 0x00200000,
  47. MBEX_DEFBUTTON4 = 0x00400000,
  48. //
  49. // Icons
  50. //
  51. MBEX_ICONWARNING = 0x00000100,
  52. MBEX_ICONINFORMATION = 0x00000000,
  53. MBEX_ICONQUESTION = 0x00000400,
  54. MBEX_ICONERROR = 0x00000800,
  55. //
  56. // Advanced flags
  57. //
  58. MBEX_HIDEFUTUREMESSAGES = 0x00010000,
  59. //
  60. // Return values
  61. //
  62. IDMBEX_OK = 0x00000001,
  63. IDMBEX_CANCEL = 0x00000002,
  64. IDMBEX_RETRY = 0x00000004,
  65. IDMBEX_SKIP = 0x00000005,
  66. IDMBEX_YES = 0x00000006,
  67. IDMBEX_NO = 0x00000007,
  68. IDMBEX_SKIPALL = 0x00000012,
  69. IDMBEX_YESTOALL = 0x00000013,
  70. IDMBEX_NOTOALL = 0x00000014
  71. };
  72. public:
  73. class CData
  74. {
  75. public:
  76. UINT m_Buttons[MaxButtons];
  77. CSimpleString m_strTitle;
  78. CSimpleString m_strMessage;
  79. UINT m_nButtonCount;
  80. UINT m_nFlags;
  81. HICON m_hIcon;
  82. LPARAM m_lParam;
  83. UINT m_nDefault;
  84. bool m_bHideMessageInFuture;
  85. private:
  86. CData( const CData & );
  87. CData &operator=( const CData & );
  88. public:
  89. CData(void)
  90. : m_strTitle(TEXT("")),
  91. m_strMessage(TEXT("")),
  92. m_nButtonCount(0),
  93. m_nFlags(0),
  94. m_hIcon(NULL),
  95. m_lParam(0),
  96. m_nDefault(0),
  97. m_bHideMessageInFuture(FALSE)
  98. {
  99. ZeroMemory( m_Buttons, ARRAYSIZE(m_Buttons) );
  100. }
  101. };
  102. private:
  103. HWND m_hWnd;
  104. CData *m_pData;
  105. private:
  106. CMessageBoxEx(void);
  107. CMessageBoxEx( const CMessageBoxEx & );
  108. CMessageBoxEx &operator=( const CMessageBoxEx & );
  109. private:
  110. explicit CMessageBoxEx( HWND hWnd );
  111. LRESULT OnInitDialog( WPARAM, LPARAM lParam );
  112. LRESULT OnCommand( WPARAM wParam, LPARAM lParam );
  113. public:
  114. static INT_PTR CALLBACK DialogProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
  115. public:
  116. static UINT MessageBox( HWND hWndParent, LPCTSTR pszMessage, LPCTSTR pszTitle, UINT nFlags, bool *pbHideFutureMessages );
  117. static UINT MessageBox( HWND hWndParent, LPCTSTR pszMessage, LPCTSTR pszTitle, UINT nFlags, bool &bHideFutureMessages );
  118. static UINT MessageBox( HWND hWndParent, LPCTSTR pszMessage, LPCTSTR pszTitle, UINT nFlags );
  119. static UINT MessageBox( LPCTSTR pszMessage, LPCTSTR pszTitle, UINT nFlags );
  120. static UINT MessageBox( HWND hWndParent, HINSTANCE hInstance, UINT nMessageId, UINT nTitleId, UINT nFlags, bool &bHideFutureMessages );
  121. static UINT MessageBox( HWND hWndParent, LPCTSTR pszTitle, UINT nFlags, LPCTSTR pszFormat, ... );
  122. static UINT MessageBox( HWND hWndParent, LPCTSTR pszTitle, UINT nFlags, bool &bHideFutureMessages, LPCTSTR pszFormat, ... );
  123. static UINT MessageBox( HWND hWndParent, HINSTANCE hInstance, UINT nTitleId, UINT nFlags, UINT nFormatId, ... );
  124. };
  125. #endif // __MBOXEX_H_INCLUDED