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.

258 lines
4.7 KiB

  1. /*++
  2. Copyright (c) 1994-1998 Microsoft Corporation
  3. Module Name :
  4. errordlg.h
  5. Abstract:
  6. Error dialog definitions
  7. Author:
  8. Ronald Meijer (ronaldm)
  9. Project:
  10. Internet Services Manager
  11. Revision History:
  12. --*/
  13. #ifndef __ERRORDLG_H__
  14. #define __ERRORDLG_H__
  15. class CCustomError : public CObjectPlus
  16. /*++
  17. Class Description:
  18. Error definitions
  19. Public Interface:
  20. CCustomError : Constructors
  21. IsURL : TRUE if the custom error is an URL
  22. IsFILE : TRUE if the custom error is a file
  23. IsDefault : TRUE if the custom error is a default error
  24. URLSupported : TRUE if URLS are supported for this error type
  25. SetValue : Set the value on the custom error
  26. MakeDefault : Make the error a default error
  27. --*/
  28. {
  29. //
  30. // Error types
  31. //
  32. public:
  33. enum ERT
  34. {
  35. ERT_DEFAULT,
  36. ERT_FILE,
  37. ERT_URL,
  38. };
  39. //
  40. // Constructor
  41. //
  42. public:
  43. //
  44. // Construct error definition from metabase error
  45. // error description string.
  46. //
  47. CCustomError(LPCTSTR lpstrErrorString);
  48. //
  49. // Access
  50. //
  51. public:
  52. BOOL IsURL() const;
  53. BOOL IsFile() const;
  54. BOOL IsDefault() const;
  55. BOOL URLSupported() const { return m_fURLSupported; }
  56. void MakeDefault();
  57. void SetValue(
  58. IN ERT nType,
  59. IN LPCTSTR lpText
  60. );
  61. //
  62. // Helper Functions
  63. //
  64. public:
  65. //
  66. // Build error string
  67. //
  68. void BuildErrorString(
  69. OUT CString & str
  70. );
  71. //
  72. // Parse the error string into component parts
  73. //
  74. static BOOL CrackErrorString(
  75. IN LPCTSTR lpstrErrorString,
  76. OUT UINT & nError,
  77. OUT UINT & nSubError,
  78. OUT ERT & nType,
  79. OUT CString & str
  80. );
  81. //
  82. // Sorting helper
  83. //
  84. int OrderByErrorNum(
  85. IN const CObjectPlus * pobAccess
  86. ) const;
  87. protected:
  88. //
  89. // Parse error description string into component parts
  90. //
  91. static void CrackErrorDescription(
  92. IN LPCTSTR lpstrErrorString,
  93. OUT UINT & nError,
  94. OUT UINT & nSubError,
  95. OUT BOOL & fURLSupported,
  96. OUT CString & str
  97. );
  98. //
  99. // Metabase values
  100. //
  101. protected:
  102. static LPCTSTR s_szSep;
  103. static LPCTSTR s_szFile;
  104. static LPCTSTR s_szURL;
  105. static LPCTSTR s_szNoSubError;
  106. public:
  107. ERT m_nType;
  108. UINT m_nError;
  109. UINT m_nSubError;
  110. BOOL m_fURLSupported;
  111. CString m_str;
  112. CString m_strDefault;
  113. };
  114. class CCustomErrorDlg : public CDialog
  115. /*++
  116. Class Description:
  117. HTTP Error dialog
  118. Public Interface:
  119. CCustomErrorDlg : Constructor
  120. --*/
  121. {
  122. //
  123. // Construction
  124. //
  125. public:
  126. CCustomErrorDlg(
  127. IN CCustomError * pErr,
  128. IN BOOL fLocal,
  129. IN CWnd * pParent = NULL
  130. );
  131. //
  132. // Dialog Data
  133. //
  134. protected:
  135. //{{AFX_DATA(CCustomErrorDlg)
  136. enum { IDD = IDD_ERROR_MAPPING };
  137. int m_nMessageType;
  138. CString m_strTextFile;
  139. CEdit m_edit_TextFile;
  140. CStatic m_static_SubErrorPrompt;
  141. CStatic m_static_SubError;
  142. CStatic m_static_TextFilePrompt;
  143. CButton m_button_Browse;
  144. CButton m_button_OK;
  145. CComboBox m_combo_MessageType;
  146. CString m_strDefText;
  147. //}}AFX_DATA
  148. //
  149. // Overrides
  150. //
  151. protected:
  152. // ClassWizard generated virtual function overrides
  153. //{{AFX_VIRTUAL(CCustomErrorDlg)
  154. protected:
  155. virtual void DoDataExchange(CDataExchange * pDX);
  156. //}}AFX_VIRTUAL
  157. //
  158. // Implementation
  159. //
  160. protected:
  161. // Generated message map functions
  162. //{{AFX_MSG(CCustomErrorDlg)
  163. afx_msg void OnSelchangeComboMessageType();
  164. afx_msg void OnButtonBrowse();
  165. virtual BOOL OnInitDialog();
  166. virtual void OnOK();
  167. afx_msg void OnChangeEditTextFile();
  168. //}}AFX_MSG
  169. DECLARE_MESSAGE_MAP()
  170. BOOL SetControlStates();
  171. private:
  172. BOOL m_fLocal;
  173. CString m_strFile;
  174. CString m_strURL;
  175. CCustomError * m_pErr;
  176. };
  177. //
  178. // Inline Expansion
  179. //
  180. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  181. inline BOOL CCustomError::IsURL() const
  182. {
  183. return m_nType == ERT_URL;
  184. }
  185. inline BOOL CCustomError::IsFile() const
  186. {
  187. return m_nType == ERT_FILE;
  188. }
  189. inline BOOL CCustomError::IsDefault() const
  190. {
  191. return m_nType == ERT_DEFAULT;
  192. }
  193. inline void CCustomError::SetValue(
  194. IN ERT nType,
  195. IN LPCTSTR lpText
  196. )
  197. {
  198. m_str = lpText;
  199. m_nType = nType;
  200. }
  201. inline void CCustomError::MakeDefault()
  202. {
  203. m_nType = ERT_DEFAULT;
  204. }
  205. #endif // __ERRORDLG_H__