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.

307 lines
4.9 KiB

  1. /*++
  2. Copyright (c) 1994-1998 Microsoft Corporation
  3. Module Name :
  4. fmessage.cpp
  5. Abstract:
  6. FTP Messages property page
  7. Author:
  8. Ronald Meijer (ronaldm)
  9. Project:
  10. Internet Services Manager
  11. Revision History:
  12. --*/
  13. //
  14. // Include Files
  15. //
  16. #include "stdafx.h"
  17. #include "fscfg.h"
  18. #include "fmessage.h"
  19. #ifdef _DEBUG
  20. #undef THIS_FILE
  21. static char BASED_CODE THIS_FILE[] = __FILE__;
  22. #endif
  23. IMPLEMENT_DYNCREATE(CFtpMessagePage, CInetPropertyPage)
  24. CFtpMessagePage::CFtpMessagePage(
  25. IN CInetPropertySheet * pSheet
  26. )
  27. /*++
  28. Routine Description:
  29. Constructor for FTP message property page
  30. Arguments:
  31. CInetPropertySheet * pSheet : Associated property sheet
  32. Return Value:
  33. N/A
  34. --*/
  35. : CInetPropertyPage(CFtpMessagePage::IDD, pSheet)
  36. {
  37. #ifdef _DEBUG
  38. afxMemDF |= checkAlwaysMemDF;
  39. #endif // _DEBUG
  40. #if 0 // Keep class wizard happy
  41. //{{AFX_DATA_INIT(CFtpMessagePage)
  42. m_strExitMessage = _T("");
  43. m_strMaxConMsg = _T("");
  44. m_strWelcome = _T("");
  45. //}}AFX_DATA_INIT
  46. #endif // 0
  47. m_hInstRichEdit = LoadLibrary(_T("RichEd20.dll"));
  48. }
  49. CFtpMessagePage::~CFtpMessagePage()
  50. /*++
  51. Routine Description:
  52. Destructor
  53. Arguments:
  54. N/A
  55. Return Value:
  56. N/A
  57. --*/
  58. {
  59. if (m_hInstRichEdit != NULL)
  60. FreeLibrary(m_hInstRichEdit);
  61. }
  62. void
  63. CFtpMessagePage::DoDataExchange(
  64. IN CDataExchange * pDX
  65. )
  66. /*++
  67. Routine Description:
  68. Initialise/Store control data
  69. Arguments:
  70. CDataExchange * pDX - DDX/DDV control structure
  71. Return Value:
  72. None
  73. --*/
  74. {
  75. CInetPropertyPage::DoDataExchange(pDX);
  76. //{{AFX_DATA_MAP(CFtpMessagePage)
  77. DDX_Control(pDX, IDC_EDIT_EXIT, m_edit_Exit);
  78. DDX_Control(pDX, IDC_EDIT_MAX_CONNECTIONS, m_edit_MaxCon);
  79. DDX_Text(pDX, IDC_EDIT_EXIT, m_strExitMessage);
  80. DDX_Text(pDX, IDC_EDIT_MAX_CONNECTIONS, m_strMaxConMsg);
  81. DDX_Text(pDX, IDC_EDIT_WELCOME, m_strWelcome);
  82. //}}AFX_DATA_MAP
  83. }
  84. //
  85. // Message Map
  86. //
  87. BEGIN_MESSAGE_MAP(CFtpMessagePage, CInetPropertyPage)
  88. //{{AFX_MSG_MAP(CFtpMessagePage)
  89. //}}AFX_MSG_MAP
  90. ON_EN_CHANGE(IDC_EDIT_EXIT, OnItemChanged)
  91. ON_EN_CHANGE(IDC_EDIT_MAX_CONNECTIONS, OnItemChanged)
  92. ON_EN_CHANGE(IDC_EDIT_WELCOME, OnItemChanged)
  93. END_MESSAGE_MAP()
  94. //
  95. // Message Handlers
  96. //
  97. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  98. BOOL
  99. CFtpMessagePage::OnInitDialog()
  100. /*++
  101. Routine Description:
  102. WM_INITDIALOG handler. Initialize the dialog.
  103. Arguments:
  104. None.
  105. Return Value:
  106. TRUE if no focus is to be set automatically, FALSE if the focus
  107. is already set.
  108. --*/
  109. {
  110. CInetPropertyPage::OnInitDialog();
  111. CHARFORMAT cf;
  112. ZeroMemory(&cf, sizeof(cf));
  113. cf.cbSize = sizeof(cf);
  114. cf.dwMask = CFM_FACE;
  115. cf.bPitchAndFamily = FIXED_PITCH | FF_DONTCARE;
  116. lstrcpyn((LPTSTR)cf.szFaceName, _T("Courier"), LF_FACESIZE);
  117. SendDlgItemMessage(IDC_EDIT_WELCOME, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
  118. DWORD event = (DWORD)SendDlgItemMessage(IDC_EDIT_WELCOME, EM_GETEVENTMASK, 0, 0);
  119. event |= ENM_CHANGE;
  120. SendDlgItemMessage(IDC_EDIT_WELCOME, EM_SETEVENTMASK, 0, (LPARAM)event);
  121. return TRUE;
  122. }
  123. /* virtual */
  124. HRESULT
  125. CFtpMessagePage::FetchLoadedValues()
  126. /*++
  127. Routine Description:
  128. Move configuration data from sheet to dialog controls
  129. Arguments:
  130. None
  131. Return Value:
  132. HRESULT
  133. --*/
  134. {
  135. CError err;
  136. BEGIN_META_INST_READ(CFtpSheet)
  137. //
  138. // Use m_ notation because the message cracker functions require it.
  139. //
  140. CStringListEx m_strlWelcome;
  141. FETCH_INST_DATA_FROM_SHEET(m_strExitMessage);
  142. FETCH_INST_DATA_FROM_SHEET(m_strMaxConMsg);
  143. FETCH_INST_DATA_FROM_SHEET(m_strlWelcome);
  144. //
  145. // Incoming strings contain '\r' at the end of each string.
  146. // Append a '\n' for internal consumption
  147. //
  148. ConvertStringListToSepLine(m_strlWelcome, m_strWelcome, _T("\n"));
  149. END_META_INST_READ(err)
  150. return err;
  151. }
  152. /* virtual */
  153. HRESULT
  154. CFtpMessagePage::SaveInfo()
  155. /*++
  156. Routine Description:
  157. Save the information on this property page
  158. Arguments:
  159. None
  160. Return Value:
  161. Error return code
  162. --*/
  163. {
  164. ASSERT(IsDirty());
  165. TRACEEOLID("Saving FTP message page now...");
  166. CError err;
  167. BeginWaitCursor();
  168. //
  169. // Use m_ notation because the message cracker macros require
  170. // it.
  171. //
  172. CStringListEx m_strlWelcome;
  173. ConvertSepLineToStringList(m_strWelcome, m_strlWelcome, _T("\n"));
  174. BEGIN_META_INST_WRITE(CFtpSheet)
  175. STORE_INST_DATA_ON_SHEET(m_strExitMessage)
  176. STORE_INST_DATA_ON_SHEET(m_strMaxConMsg)
  177. STORE_INST_DATA_ON_SHEET(m_strlWelcome)
  178. END_META_INST_WRITE(err)
  179. EndWaitCursor();
  180. return err;
  181. }
  182. void
  183. CFtpMessagePage::OnItemChanged()
  184. /*++
  185. Routine Description:
  186. Register a change in control value on this page. Mark the page as dirty.
  187. All change messages map to this function
  188. Arguments:
  189. None
  190. Return Value:
  191. None
  192. --*/
  193. {
  194. SetModified(TRUE);
  195. }