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.

243 lines
6.2 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1996-1997 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // BarfDlg.h
  7. //
  8. // Abstract:
  9. // Definition of the Basic Artifical Resource Failure dialog classes.
  10. //
  11. // Implementation File:
  12. // BarfDlg.cpp
  13. //
  14. // Author:
  15. // David Potter (davidp) April 11, 1997
  16. //
  17. // Revision History:
  18. //
  19. // Notes:
  20. // This file compiles only in _DEBUG mode.
  21. //
  22. // To implement a new BARF type, declare a global instance of CBarf:
  23. // CBarf g_barfMyApi(_T("My API"));
  24. //
  25. // To bring up the BARF dialog:
  26. // DoBarfDialog();
  27. // This brings up a modeless dialog with the BARF settings.
  28. //
  29. // A few functions are provided for special circumstances.
  30. // Usage of these should be fairly limited:
  31. // BarfAll(void); Top Secret -> NYI.
  32. // EnableBarf(BOOL); Allows you to disable/reenable BARF.
  33. // FailOnNextBarf; Force the next failable call to fail.
  34. //
  35. // NOTE: Your code calls the standard APIs (e.g. LoadIcon) and the
  36. // BARF files do the rest.
  37. //
  38. /////////////////////////////////////////////////////////////////////////////
  39. #ifndef _BARFDLG_H_
  40. #define _BARFDLG_H_
  41. /////////////////////////////////////////////////////////////////////////////
  42. // Forward Class Declarations
  43. /////////////////////////////////////////////////////////////////////////////
  44. class CBarfDialog;
  45. class CBarfAllDialog;
  46. /////////////////////////////////////////////////////////////////////////////
  47. // External Class Declarations
  48. /////////////////////////////////////////////////////////////////////////////
  49. class CBarf;
  50. /////////////////////////////////////////////////////////////////////////////
  51. // Include Files
  52. /////////////////////////////////////////////////////////////////////////////
  53. /////////////////////////////////////////////////////////////////////////////
  54. //
  55. // class CBarfDialog
  56. //
  57. // Purpose:
  58. // Implements the BARF Settings dialog
  59. //
  60. // Usage:
  61. // Use the constructor, then Create().
  62. // Update() is called by CBarf::BFail() to indicate
  63. // one of the current counts has changed.
  64. //
  65. /////////////////////////////////////////////////////////////////////////////
  66. #ifdef _DEBUG
  67. class CBarfDialog : public CDialog
  68. {
  69. // Construction
  70. public:
  71. CBarfDialog(void);
  72. BOOL Create(CWnd * pParentWnd = NULL);
  73. // Dialog Data
  74. //{{AFX_DATA(CBarfDialog)
  75. enum { IDD = IDD_BARF_SETTINGS };
  76. CButton m_ckbGlobalEnable;
  77. CButton m_ckbDisable;
  78. CButton m_ckbContinuous;
  79. CListCtrl m_lcCategories;
  80. DWORD m_nFailAt;
  81. BOOL m_bContinuous;
  82. BOOL m_bDisable;
  83. BOOL m_bGlobalEnable;
  84. //}}AFX_DATA
  85. // CButton m_ckbGlobalEnable;
  86. // CButton m_ckbDisable;
  87. // CButton m_ckbContinuous;
  88. // CListCtrl m_lcCategories;
  89. // DWORD m_nFailAt;
  90. // BOOL m_bContinuous;
  91. // BOOL m_bDisable;
  92. // BOOL m_bGlobalEnable;
  93. // Overrides
  94. // ClassWizard generated virtual function overrides
  95. //{{AFX_VIRTUAL(CBarfDialog)
  96. protected:
  97. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  98. virtual void PostNcDestroy();
  99. //}}AFX_VIRTUAL
  100. // Implementation
  101. protected:
  102. private:
  103. static CBarfDialog * s_pdlg;
  104. static HICON s_hicon;
  105. protected:
  106. CBarf * m_pbarfSelected;
  107. // Generated message map functions
  108. //{{AFX_MSG(CBarfDialog)
  109. virtual BOOL OnInitDialog();
  110. afx_msg void OnResetCurrentCount();
  111. afx_msg void OnResetAllCounts();
  112. afx_msg void OnGlobalEnable();
  113. afx_msg void OnItemChanged(NMHDR* pNMHDR, LRESULT* pResult);
  114. afx_msg void OnStatusChange();
  115. afx_msg void OnClose();
  116. //}}AFX_MSG
  117. virtual void OnCancel();
  118. afx_msg LRESULT OnBarfUpdate(WPARAM wparam, LPARAM lparam);
  119. DECLARE_MESSAGE_MAP()
  120. // virtual LRESULT LDlgProc(UINT, WPARAM, LPARAM);
  121. // void GetSelection(void);
  122. // void OnGlobalEnable(void);
  123. // void OnResetAllCounts(void);
  124. // void OnSelectionChange(void);
  125. // void OnStatusChange(IN BOOL bReset);
  126. // void FormatBarfString(CBarf *, CString * pstr);
  127. void FillList(void);
  128. static void PostUpdate(void);
  129. public:
  130. static CBarfDialog * Pdlg() { return s_pdlg; }
  131. void OnUpdate(void);
  132. }; //*** class CBarfDialog
  133. #endif // _DEBUG
  134. /////////////////////////////////////////////////////////////////////////////
  135. //
  136. // class CBarfAllDialog
  137. //
  138. // Purpose:
  139. // Implements the Barf Everything dialog.
  140. //
  141. // Usage:
  142. // Similar to most Modal dialogs: Construct, then do dlg.DoModal()
  143. // In addition, the methods Hwnd(), Wm(), Wparam() and Lparam()
  144. // can be called when the dialog is dismissed (only if DoModal()
  145. // returns IDOK).
  146. //
  147. /////////////////////////////////////////////////////////////////////////////
  148. #ifdef _DEBUG
  149. class CBarfAllDialog : public CDialog
  150. {
  151. // Construction
  152. public:
  153. CBarfAllDialog(IN OUT CWnd * pParent);
  154. protected:
  155. // Dialog Data
  156. //{{AFX_DATA(CBarfAllDialog)
  157. enum { IDD = IDD_BARF_ALL_SETTINGS };
  158. CEdit m_editLparam;
  159. CEdit m_editWparam;
  160. CEdit m_editWm;
  161. CEdit m_editHwnd;
  162. //}}AFX_DATA
  163. HWND m_hwndBarf;
  164. UINT m_wmBarf;
  165. WPARAM m_wparamBarf;
  166. LPARAM m_lparamBarf;
  167. public:
  168. HWND HwndBarf(void) { return m_hwndBarf; }
  169. UINT WmBarf(void) { return m_wmBarf; }
  170. WPARAM WparamBarf(void) { return m_wparamBarf; }
  171. LPARAM LparamBarf(void) { return m_lparamBarf; }
  172. // Overrides
  173. // ClassWizard generated virtual function overrides
  174. //{{AFX_VIRTUAL(CBarfAllDialog)
  175. protected:
  176. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  177. //}}AFX_VIRTUAL
  178. // Implementation
  179. protected:
  180. // Generated message map functions
  181. //{{AFX_MSG(CBarfAllDialog)
  182. virtual BOOL OnInitDialog();
  183. afx_msg void OnMenuItem();
  184. virtual void OnOK();
  185. //}}AFX_MSG
  186. DECLARE_MESSAGE_MAP()
  187. // virtual void OnButton(ID id);
  188. // virtual void OnOK(void);
  189. }; //*** class CBarfAllDialog
  190. #endif // _DEBUG
  191. /////////////////////////////////////////////////////////////////////////////
  192. // Global Functions and Data
  193. /////////////////////////////////////////////////////////////////////////////
  194. #ifdef _DEBUG
  195. void DoBarfDialog(void);
  196. void BarfAll(void);
  197. #else
  198. inline void DoBarfDialog(void) { }
  199. inline void BarfAll(void) { }
  200. #endif // _DEBUG
  201. /////////////////////////////////////////////////////////////////////////////
  202. #endif // _BARFDLG_H_