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.

250 lines
4.3 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. protected:
  82. //
  83. // Parse error description string into component parts
  84. //
  85. static void CrackErrorDescription(
  86. IN LPCTSTR lpstrErrorString,
  87. OUT UINT & nError,
  88. OUT UINT & nSubError,
  89. OUT BOOL & fURLSupported,
  90. OUT CString & str
  91. );
  92. //
  93. // Metabase values
  94. //
  95. protected:
  96. static LPCTSTR s_szSep;
  97. static LPCTSTR s_szFile;
  98. static LPCTSTR s_szURL;
  99. static LPCTSTR s_szNoSubError;
  100. public:
  101. ERT m_nType;
  102. UINT m_nError;
  103. UINT m_nSubError;
  104. BOOL m_fURLSupported;
  105. CString m_str;
  106. CString m_strDefault;
  107. };
  108. class CCustomErrorDlg : public CDialog
  109. /*++
  110. Class Description:
  111. HTTP Error dialog
  112. Public Interface:
  113. CCustomErrorDlg : Constructor
  114. --*/
  115. {
  116. //
  117. // Construction
  118. //
  119. public:
  120. CCustomErrorDlg(
  121. IN CCustomError * pErr,
  122. IN BOOL fLocal,
  123. IN CWnd * pParent = NULL
  124. );
  125. //
  126. // Dialog Data
  127. //
  128. protected:
  129. //{{AFX_DATA(CCustomErrorDlg)
  130. enum { IDD = IDD_ERROR_MAPPING };
  131. int m_nMessageType;
  132. CString m_strTextFile;
  133. CEdit m_edit_TextFile;
  134. CStatic m_static_SubErrorPrompt;
  135. CStatic m_static_SubError;
  136. CStatic m_static_TextFilePrompt;
  137. CButton m_button_Browse;
  138. CButton m_button_OK;
  139. CComboBox m_combo_MessageType;
  140. CString m_strDefText;
  141. //}}AFX_DATA
  142. //
  143. // Overrides
  144. //
  145. protected:
  146. // ClassWizard generated virtual function overrides
  147. //{{AFX_VIRTUAL(CCustomErrorDlg)
  148. protected:
  149. virtual void DoDataExchange(CDataExchange * pDX);
  150. //}}AFX_VIRTUAL
  151. //
  152. // Implementation
  153. //
  154. protected:
  155. // Generated message map functions
  156. //{{AFX_MSG(CCustomErrorDlg)
  157. afx_msg void OnSelchangeComboMessageType();
  158. afx_msg void OnButtonBrowse();
  159. virtual BOOL OnInitDialog();
  160. virtual void OnOK();
  161. afx_msg void OnChangeEditTextFile();
  162. //}}AFX_MSG
  163. DECLARE_MESSAGE_MAP()
  164. BOOL SetControlStates();
  165. private:
  166. BOOL m_fLocal;
  167. CString m_strFile;
  168. CString m_strURL;
  169. CCustomError * m_pErr;
  170. };
  171. //
  172. // Inline Expansion
  173. //
  174. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  175. inline BOOL CCustomError::IsURL() const
  176. {
  177. return m_nType == ERT_URL;
  178. }
  179. inline BOOL CCustomError::IsFile() const
  180. {
  181. return m_nType == ERT_FILE;
  182. }
  183. inline BOOL CCustomError::IsDefault() const
  184. {
  185. return m_nType == ERT_DEFAULT;
  186. }
  187. inline void CCustomError::SetValue(
  188. IN ERT nType,
  189. IN LPCTSTR lpText
  190. )
  191. {
  192. m_str = lpText;
  193. m_nType = nType;
  194. }
  195. inline void CCustomError::MakeDefault()
  196. {
  197. m_nType = ERT_DEFAULT;
  198. }
  199. #endif // __ERRORDLG_H__