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.

248 lines
7.4 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1996-1997 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // GenApp.cpp
  7. //
  8. // Abstract:
  9. // Implementation of the CGenericAppParamsPage class.
  10. //
  11. // Author:
  12. // David Potter (davidp) June 5, 1996
  13. //
  14. // Revision History:
  15. //
  16. // Notes:
  17. //
  18. /////////////////////////////////////////////////////////////////////////////
  19. #include "stdafx.h"
  20. #include "CluAdmX.h"
  21. #include "ExtObj.h"
  22. #include "GenApp.h"
  23. #include "DDxDDv.h"
  24. #include "PropList.h"
  25. #include "HelpData.h" // for g_rghelpmap*
  26. #ifdef _DEBUG
  27. #define new DEBUG_NEW
  28. #undef THIS_FILE
  29. static char THIS_FILE[] = __FILE__;
  30. #endif
  31. /////////////////////////////////////////////////////////////////////////////
  32. // CGenericAppParamsPage property page
  33. /////////////////////////////////////////////////////////////////////////////
  34. IMPLEMENT_DYNCREATE(CGenericAppParamsPage, CBasePropertyPage)
  35. /////////////////////////////////////////////////////////////////////////////
  36. // Message Maps
  37. BEGIN_MESSAGE_MAP(CGenericAppParamsPage, CBasePropertyPage)
  38. //{{AFX_MSG_MAP(CGenericAppParamsPage)
  39. ON_EN_CHANGE(IDC_PP_GENAPP_PARAMS_COMMAND_LINE, OnChangeRequired)
  40. ON_EN_CHANGE(IDC_PP_GENAPP_PARAMS_CURRENT_DIRECTORY, OnChangeRequired)
  41. //}}AFX_MSG_MAP
  42. ON_BN_CLICKED(IDC_PP_GENAPP_PARAMS_INTERACT_WITH_DESKTOP, CBasePropertyPage::OnChangeCtrl)
  43. ON_BN_CLICKED(IDC_PP_GENAPP_PARAMS_USE_NETWORK_NAME, CBasePropertyPage::OnChangeCtrl)
  44. END_MESSAGE_MAP()
  45. /////////////////////////////////////////////////////////////////////////////
  46. //++
  47. //
  48. // CGenericAppParamsPage::CGenericAppParamsPage
  49. //
  50. // Routine Description:
  51. // Default constructor.
  52. //
  53. // Arguments:
  54. // None.
  55. //
  56. // Return Value:
  57. // None.
  58. //
  59. //--
  60. /////////////////////////////////////////////////////////////////////////////
  61. CGenericAppParamsPage::CGenericAppParamsPage(void)
  62. : CBasePropertyPage(g_aHelpIDs_IDD_PP_GENAPP_PARAMETERS, g_aHelpIDs_IDD_WIZ_GENAPP_PARAMETERS)
  63. {
  64. //{{AFX_DATA_INIT(CGenericAppParamsPage)
  65. m_strCommandLine = _T("");
  66. m_strCurrentDirectory = _T("");
  67. m_bInteractWithDesktop = FALSE;
  68. m_bUseNetworkName = FALSE;
  69. //}}AFX_DATA_INIT
  70. m_bInteractWithDesktop = FALSE;
  71. m_bUseNetworkName = FALSE;
  72. // Setup the property array.
  73. {
  74. m_rgProps[epropCommandLine].Set(REGPARAM_GENAPP_COMMAND_LINE, m_strCommandLine, m_strPrevCommandLine);
  75. m_rgProps[epropCurrentDirectory].Set(REGPARAM_GENAPP_CURRENT_DIRECTORY, m_strCurrentDirectory, m_strPrevCurrentDirectory);
  76. m_rgProps[epropInteractWithDesktop].Set(REGPARAM_GENAPP_INTERACT_WITH_DESKTOP, m_bInteractWithDesktop, m_bPrevInteractWithDesktop);
  77. m_rgProps[epropUseNetworkName].Set(REGPARAM_GENAPP_USE_NETWORK_NAME, m_bUseNetworkName, m_bPrevUseNetworkName);
  78. } // Setup the property array
  79. m_iddPropertyPage = IDD_PP_GENAPP_PARAMETERS;
  80. m_iddWizardPage = IDD_WIZ_GENAPP_PARAMETERS;
  81. } //*** CGenericAppParamsPage::CGenericAppParamsPage()
  82. /////////////////////////////////////////////////////////////////////////////
  83. //++
  84. //
  85. // CGenericAppParamsPage::DoDataExchange
  86. //
  87. // Routine Description:
  88. // Do data exchange between the dialog and the class.
  89. //
  90. // Arguments:
  91. // pDX [IN OUT] Data exchange object
  92. //
  93. // Return Value:
  94. // None.
  95. //
  96. //--
  97. /////////////////////////////////////////////////////////////////////////////
  98. void CGenericAppParamsPage::DoDataExchange(CDataExchange * pDX)
  99. {
  100. if (!pDX->m_bSaveAndValidate || !BSaved())
  101. {
  102. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  103. //{{AFX_DATA_MAP(CGenericAppParamsPage)
  104. DDX_Control(pDX, IDC_PP_GENAPP_PARAMS_CURRENT_DIRECTORY, m_editCurrentDirectory);
  105. DDX_Control(pDX, IDC_PP_GENAPP_PARAMS_USE_NETWORK_NAME, m_ckbUseNetworkName);
  106. DDX_Control(pDX, IDC_PP_GENAPP_PARAMS_COMMAND_LINE, m_editCommandLine);
  107. DDX_Text(pDX, IDC_PP_GENAPP_PARAMS_COMMAND_LINE, m_strCommandLine);
  108. DDX_Text(pDX, IDC_PP_GENAPP_PARAMS_CURRENT_DIRECTORY, m_strCurrentDirectory);
  109. DDX_Check(pDX, IDC_PP_GENAPP_PARAMS_INTERACT_WITH_DESKTOP, m_bInteractWithDesktop);
  110. DDX_Check(pDX, IDC_PP_GENAPP_PARAMS_USE_NETWORK_NAME, m_bUseNetworkName);
  111. //}}AFX_DATA_MAP
  112. if (!BBackPressed())
  113. {
  114. DDV_RequiredText(pDX, IDC_PP_GENAPP_PARAMS_COMMAND_LINE, IDC_PP_GENAPP_PARAMS_COMMAND_LINE_LABEL, m_strCommandLine);
  115. DDV_RequiredText(pDX, IDC_PP_GENAPP_PARAMS_CURRENT_DIRECTORY, IDC_PP_GENAPP_PARAMS_CURRENT_DIRECTORY_LABEL, m_strCurrentDirectory);
  116. DDV_Path(pDX, IDC_PP_GENAPP_PARAMS_CURRENT_DIRECTORY, IDC_PP_GENAPP_PARAMS_CURRENT_DIRECTORY_LABEL, m_strCurrentDirectory);
  117. } // if: Back button not pressed
  118. } // if: not saving or haven't saved yet
  119. CBasePropertyPage::DoDataExchange(pDX);
  120. } //*** CGenericAppParamsPage::DoDataExchange()
  121. /////////////////////////////////////////////////////////////////////////////
  122. //++
  123. //
  124. // CGenericAppParamsPage::OnInitDialog
  125. //
  126. // Routine Description:
  127. // Handler for the WM_INITDIALOG message.
  128. //
  129. // Arguments:
  130. // None.
  131. //
  132. // Return Value:
  133. // TRUE We need the focus to be set for us.
  134. // FALSE We already set the focus to the proper control.
  135. //
  136. //--
  137. /////////////////////////////////////////////////////////////////////////////
  138. BOOL CGenericAppParamsPage::OnInitDialog(void)
  139. {
  140. // Get a default value for the current directory if it hasn't been set yet.
  141. if (m_strCurrentDirectory.GetLength() == 0)
  142. ConstructDefaultDirectory(m_strCurrentDirectory, IDS_DEFAULT_GENAPP_CURRENT_DIR);
  143. // Call the base class.
  144. CBasePropertyPage::OnInitDialog();
  145. return TRUE; // return TRUE unless you set the focus to a control
  146. // EXCEPTION: OCX Property Pages should return FALSE
  147. } //*** CGenericAppParamsPage::OnInitDialog()
  148. /////////////////////////////////////////////////////////////////////////////
  149. //++
  150. //
  151. // CGenericAppParamsPage::OnSetActive
  152. //
  153. // Routine Description:
  154. // Handler for the PSN_SETACTIVE message.
  155. //
  156. // Arguments:
  157. // None.
  158. //
  159. // Return Value:
  160. // TRUE Page successfully initialized.
  161. // FALSE Page not initialized.
  162. //
  163. //--
  164. /////////////////////////////////////////////////////////////////////////////
  165. BOOL CGenericAppParamsPage::OnSetActive(void)
  166. {
  167. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  168. // If there is no network name, hide the UseNetworkName control.
  169. {
  170. WCHAR wszNetName[MAX_COMPUTERNAME_LENGTH + 1];
  171. DWORD nSize = sizeof(wszNetName) / sizeof(WCHAR);
  172. BOOL bNetNameExists;
  173. bNetNameExists = Peo()->BGetResourceNetworkName(
  174. wszNetName,
  175. &nSize
  176. );
  177. m_ckbUseNetworkName.EnableWindow(bNetNameExists);
  178. } // If there is no network name, hide the UseNetworkName control
  179. // Enable/disable the Next/Finish button.
  180. if (BWizard())
  181. {
  182. if ((m_strCommandLine.GetLength() == 0)
  183. || (m_strCurrentDirectory.GetLength() == 0))
  184. EnableNext(FALSE);
  185. else
  186. EnableNext(TRUE);
  187. } // if: enable/disable the Next button
  188. return CBasePropertyPage::OnSetActive();
  189. } //*** CGenericAppParamsPage::OnSetActive()
  190. /////////////////////////////////////////////////////////////////////////////
  191. //++
  192. //
  193. // CGenericAppParamsPage::OnChangeRequired
  194. //
  195. // Routine Description:
  196. // Handler for the EN_CHANGE message on required controls.
  197. //
  198. // Arguments:
  199. // None.
  200. //
  201. // Return Value:
  202. // None.
  203. //
  204. //--
  205. /////////////////////////////////////////////////////////////////////////////
  206. void CGenericAppParamsPage::OnChangeRequired(void)
  207. {
  208. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  209. OnChangeCtrl();
  210. if (BWizard())
  211. {
  212. if ((m_editCommandLine.GetWindowTextLength() == 0)
  213. || (m_editCurrentDirectory.GetWindowTextLength() == 0))
  214. EnableNext(FALSE);
  215. else
  216. EnableNext(TRUE);
  217. } // if: in a wizard
  218. } //*** CGenericAppParamsPage::OnChangeRequired()