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.

2706 lines
84 KiB

  1. //Copyright (c) 1998 - 1999 Microsoft Corporation
  2. /*******************************************************************************
  3. *
  4. * dialogs.cpp
  5. *
  6. * implementation of WINCFG dialogs
  7. *
  8. * copyright notice: Copyright 1996, Citrix Systems Inc.
  9. *
  10. * $Author: donm $ Butch Davis
  11. *
  12. * $Log: N:\nt\private\utils\citrix\winutils\tscfg\VCS\dialogs.cpp $
  13. *
  14. * Rev 1.59 18 Apr 1998 15:32:48 donm
  15. * Added capability bits
  16. *
  17. * Rev 1.58 06 Feb 1998 14:37:52 donm
  18. * fixed trap when no encyrption levels
  19. *
  20. * Rev 1.2 29 Jan 1998 17:29:10 donm
  21. * sets default encryption and grays out control properly
  22. *
  23. * Rev 1.1 15 Jan 1998 17:57:08 thanhl
  24. * Hydra merge
  25. *
  26. * Rev 1.56 13 Jan 1998 14:08:18 donm
  27. * gets encryption levels from extension DLL
  28. *
  29. * Rev 1.55 31 Jul 1997 16:33:20 butchd
  30. * update
  31. *
  32. * Rev 1.54 25 Mar 1997 15:42:14 butchd
  33. * update
  34. *
  35. * Rev 1.53 16 Nov 1996 16:11:48 butchd
  36. * update
  37. *
  38. * Rev 1.52 27 Sep 1996 17:52:22 butchd
  39. * update
  40. *
  41. *******************************************************************************/
  42. /*
  43. * include files
  44. */
  45. #include "stdafx.h"
  46. #include "wincfg.h"
  47. #include "appsvdoc.h"
  48. #ifdef _DEBUG
  49. #undef THIS_FILE
  50. static char BASED_CODE THIS_FILE[] = __FILE__;
  51. #endif
  52. extern CWincfgApp *pApp;
  53. /*
  54. * Global variables for WINUTILS Common functions.
  55. */
  56. extern "C" HWND WinUtilsAppWindow;
  57. /*
  58. * Global command line variables.
  59. */
  60. ////////////////////////////////////////////////////////////////////////////////
  61. // CAdvancedWinStationDlg class construction / destruction, implementation
  62. /*******************************************************************************
  63. *
  64. * CAdvancedWinStationDlg - CAdvancedWinStationDlg constructor
  65. *
  66. * ENTRY:
  67. * EXIT:
  68. * (Refer to MFC CDialog::CDialog documentation)
  69. *
  70. ******************************************************************************/
  71. CAdvancedWinStationDlg::CAdvancedWinStationDlg()
  72. : CBaseDialog(CAdvancedWinStationDlg::IDD)
  73. {
  74. //{{AFX_DATA_INIT(CAdvancedWinStationDlg)
  75. // NOTE: the ClassWizard will add member initialization here
  76. //}}AFX_DATA_INIT
  77. } // end CAdvancedWinStationDlg::CAdvancedWinStationDlg
  78. ////////////////////////////////////////////////////////////////////////////////
  79. // CAdvancedWinStationDlg operations
  80. /*******************************************************************************
  81. *
  82. * HandleEnterEscKey - CAdvancedWinStationDlg member function:
  83. * private operation
  84. *
  85. * If the ENTER or ESC key is pressed while a combo box is dropped down,
  86. * treat as combo box selection (suppress OnOk/OnCancel notification).
  87. *
  88. * ENTRY:
  89. * nID (input)
  90. * IDOK if OK button (ENTER) brought us here; otherwise, IDCANCEL for
  91. * Cancel button (ESC).
  92. * EXIT:
  93. * TRUE to process Enter/Esc (perform OnOk/OnCancel); FALSE to ignore
  94. * (a combo box is dropped down).
  95. *
  96. ******************************************************************************/
  97. BOOL
  98. CAdvancedWinStationDlg::HandleEnterEscKey(int nID)
  99. {
  100. CComboBox *pEncryption = (CComboBox *)GetDlgItem(IDC_AWS_SECURITY_ENCRYPT);
  101. CComboBox *pBroken = (CComboBox *)GetDlgItem(IDC_AWS_BROKEN);
  102. CComboBox *pReconnect = (CComboBox *)GetDlgItem(IDC_AWS_RECONNECT);
  103. CComboBox *pShadow = (CComboBox *)GetDlgItem(IDC_AWS_SHADOW);
  104. /*
  105. * Check encryption level combo-box.
  106. */
  107. if ( pEncryption->GetDroppedState() ) {
  108. if ( nID == IDCANCEL ) // select original selection
  109. for(ULONG i = 0; i < m_NumEncryptionLevels; i++) {
  110. if((int)(m_UserConfig.MinEncryptionLevel) == (int)(m_pEncryptionLevels[i].RegistryValue))
  111. pEncryption->SetCurSel(i);
  112. }
  113. pEncryption->ShowDropDown(FALSE);
  114. return(FALSE);
  115. }
  116. /*
  117. * Check broken connection combo-box.
  118. */
  119. if ( pBroken->GetDroppedState() ) {
  120. if ( nID == IDCANCEL ) // select original selection
  121. pBroken->SetCurSel((int)(m_UserConfig.fResetBroken));
  122. pBroken->ShowDropDown(FALSE);
  123. return(FALSE);
  124. }
  125. /*
  126. * Check reconnect session combo-box.
  127. */
  128. if ( pReconnect->GetDroppedState() ) {
  129. if ( nID == IDCANCEL ) // select original selection
  130. pReconnect->SetCurSel((int)(m_UserConfig.fReconnectSame));
  131. pReconnect->ShowDropDown(FALSE);
  132. return(FALSE);
  133. }
  134. /*
  135. * Check shadowing combo-box.
  136. */
  137. if ( pShadow->GetDroppedState() ) {
  138. if ( nID == IDCANCEL ) // select original selection
  139. pShadow->SetCurSel((int)(m_UserConfig.Shadow));
  140. pShadow->ShowDropDown(FALSE);
  141. return(FALSE);
  142. }
  143. /*
  144. * No combo boxes are down; process Enter/Esc
  145. */
  146. return(TRUE);
  147. } // end CAdvancedWinStationDlg::HandleEnterEscKey
  148. ////////////////////////////////////////////////////////////////////////////////
  149. // CAdvancedWinStationDlg message map
  150. BEGIN_MESSAGE_MAP(CAdvancedWinStationDlg, CBaseDialog)
  151. //{{AFX_MSG_MAP(CAdvancedWinStationDlg)
  152. ON_BN_CLICKED(IDC_AWS_CONNECTION_NONE, OnClickedAwsConnectionNone)
  153. ON_BN_CLICKED(IDC_AWS_CONNECTION_INHERIT, OnClickedAwsConnectionInherit)
  154. ON_BN_CLICKED(IDC_AWS_DISCONNECTION_NONE, OnClickedAwsDisconnectionNone)
  155. ON_BN_CLICKED(IDC_AWS_DISCONNECTION_INHERIT, OnClickedAwsDisconnectionInherit)
  156. ON_BN_CLICKED(IDC_AWS_IDLE_NONE, OnClickedAwsIdleNone)
  157. ON_BN_CLICKED(IDC_AWS_IDLE_INHERIT, OnClickedAwsIdleInherit)
  158. ON_BN_CLICKED(IDC_AWS_AUTOLOGON_INHERIT, OnClickedAwsAutologonInherit)
  159. ON_BN_CLICKED(IDC_AWS_AUTOLOGON_PASSWORD_PROMPT, OnClickedAwsPromptForPassword)
  160. ON_BN_CLICKED(IDC_AWS_INITIALPROGRAM_INHERIT, OnClickedAwsInitialprogramInherit)
  161. ON_BN_CLICKED(IDC_AWS_INITIALPROGRAM_PUBLISHEDONLY, OnClickedAwsInitialprogramPublishedonly)
  162. // ON_BN_CLICKED(IDC_AWS_SECURITY_DISABLEENCRYPTION, OnClickedAwsSecurityDisableencryption)
  163. ON_BN_CLICKED(IDC_AWS_USEROVERRIDE_DISABLEWALLPAPER, OnClickedAwsUseroverrideDisablewallpaper)
  164. ON_BN_CLICKED(IDC_AWS_BROKEN_INHERIT, OnClickedAwsBrokenInherit)
  165. ON_BN_CLICKED(IDC_AWS_RECONNECT_INHERIT, OnClickedAwsReconnectInherit)
  166. ON_BN_CLICKED(IDC_AWS_SHADOW_INHERIT, OnClickedAwsShadowInherit)
  167. //}}AFX_MSG_MAP
  168. END_MESSAGE_MAP()
  169. ////////////////////////////////////////////////////////////////////////////////
  170. // CAdvancedWinStationDlg commands
  171. /*******************************************************************************
  172. *
  173. * OnInitDialog - CAdvancedWinStationDlg member function: command (override)
  174. *
  175. * Performs the dialog intialization.
  176. *
  177. * ENTRY:
  178. * EXIT:
  179. * (Refer to CDialog::OnInitDialog documentation)
  180. *
  181. ******************************************************************************/
  182. BOOL
  183. CAdvancedWinStationDlg::OnInitDialog()
  184. {
  185. int i;
  186. CString string;
  187. CComboBox *pComboBox;
  188. /*
  189. * Call the parent classes' OnInitDialog to perform default dialog
  190. * initialization.
  191. */
  192. CBaseDialog::OnInitDialog();
  193. m_Capabilities = m_pTermObject ? m_pTermObject->m_Capabilities : 0;
  194. /*
  195. * Set WinStation state radio buttons.
  196. */
  197. CheckRadioButton( IDC_AWS_WSDISABLED, IDC_AWS_WSENABLED,
  198. IDC_AWS_WSDISABLED + (int)m_fEnableWinStation );
  199. /*
  200. * Set the Connection Timeout fields.
  201. */
  202. CheckDlgButton( IDC_AWS_CONNECTION_NONE,
  203. m_UserConfig.MaxConnectionTime ? FALSE : TRUE);
  204. OnClickedAwsConnectionNone();
  205. CheckDlgButton( IDC_AWS_CONNECTION_INHERIT,
  206. m_UserConfig.fInheritMaxSessionTime );
  207. OnClickedAwsConnectionInherit();
  208. /*
  209. * Set the Disconnection Timeout fields.
  210. */
  211. CheckDlgButton( IDC_AWS_DISCONNECTION_NONE,
  212. m_UserConfig.MaxDisconnectionTime ? FALSE : TRUE);
  213. OnClickedAwsDisconnectionNone();
  214. CheckDlgButton( IDC_AWS_DISCONNECTION_INHERIT,
  215. m_UserConfig.fInheritMaxDisconnectionTime );
  216. OnClickedAwsDisconnectionInherit();
  217. /*
  218. * Set the Idle Timeout fields.
  219. */
  220. CheckDlgButton( IDC_AWS_IDLE_NONE,
  221. m_UserConfig.MaxIdleTime ? FALSE : TRUE);
  222. OnClickedAwsIdleNone();
  223. CheckDlgButton( IDC_AWS_IDLE_INHERIT,
  224. m_UserConfig.fInheritMaxIdleTime );
  225. OnClickedAwsIdleInherit();
  226. /*
  227. * Set AutoLogon fields.
  228. */
  229. CheckDlgButton( IDC_AWS_AUTOLOGON_PASSWORD_PROMPT,
  230. m_UserConfig.fPromptForPassword );
  231. CheckDlgButton( IDC_AWS_AUTOLOGON_INHERIT,
  232. m_UserConfig.fInheritAutoLogon );
  233. OnClickedAwsAutologonInherit();
  234. /*
  235. * Set Initial Program fields.
  236. */
  237. CheckDlgButton( IDC_AWS_INITIALPROGRAM_INHERIT,
  238. m_UserConfig.fInheritInitialProgram );
  239. CheckDlgButton( IDC_AWS_INITIALPROGRAM_PUBLISHEDONLY,
  240. m_UserConfig.fDisableExe );
  241. OnClickedAwsInitialprogramInherit();
  242. /*
  243. * Load combo box strings and set Security fields.
  244. */
  245. pComboBox = (CComboBox *)GetDlgItem(IDC_AWS_SECURITY_ENCRYPT);
  246. m_pEncryptionLevels = NULL;
  247. m_NumEncryptionLevels = 0L;
  248. m_DefaultEncryptionLevelIndex = 0;
  249. BOOL bSet = FALSE;
  250. // Get the array of encryption levels from the extension DLL
  251. if(m_pTermObject && m_pTermObject->m_hExtensionDLL && m_pTermObject->m_lpfnExtEncryptionLevels)
  252. m_NumEncryptionLevels = (*m_pTermObject->m_lpfnExtEncryptionLevels)(&(m_pTermObject->m_WdConfig.Wd.WdName), &m_pEncryptionLevels);
  253. if(m_pEncryptionLevels) {
  254. // Loop through the encryption levels, read in their strings,
  255. // and add them to the combo box
  256. for(UINT i = 0; i < m_NumEncryptionLevels; i++) {
  257. TCHAR estring[128];
  258. if(::LoadString(m_pTermObject->m_hExtensionDLL,
  259. m_pEncryptionLevels[i].StringID, estring, 127)) {
  260. pComboBox->AddString(estring);
  261. }
  262. // If this is the default encryption level, remember its value
  263. if(m_pEncryptionLevels[i].Flags & ELF_DEFAULT)
  264. m_DefaultEncryptionLevelIndex = i;
  265. // If this is the currently selected encryption level
  266. if(m_pEncryptionLevels[i].RegistryValue == (DWORD)m_UserConfig.MinEncryptionLevel) {
  267. bSet = TRUE;
  268. pComboBox->SetCurSel(i);
  269. }
  270. }
  271. // If the WinStation's encryption level didn't match one of the
  272. // levels returned by the extension DLL, set the level to the
  273. // default
  274. if(!bSet) {
  275. pComboBox->SetCurSel(m_DefaultEncryptionLevelIndex);
  276. m_UserConfig.MinEncryptionLevel = (UCHAR)(m_pEncryptionLevels[m_DefaultEncryptionLevelIndex].RegistryValue);
  277. }
  278. } else {
  279. // There aren't any encryption levels
  280. // Disable the combo box
  281. GetDlgItem(IDL_AWS_SECURITY_ENCRYPT1)->EnableWindow(FALSE);
  282. pComboBox->EnableWindow(FALSE);
  283. m_UserConfig.MinEncryptionLevel = 0;
  284. }
  285. CheckDlgButton( IDC_AWS_SECURITY_DEFAULTGINA,
  286. m_UserConfig.fUseDefaultGina );
  287. /*
  288. * Set User Profile Override fields
  289. */
  290. CheckDlgButton( IDC_AWS_USEROVERRIDE_DISABLEWALLPAPER,
  291. m_UserConfig.fWallPaperDisabled );
  292. /*
  293. * Load combo box strings and set Connection fields.
  294. */
  295. pComboBox = (CComboBox *)GetDlgItem(IDC_AWS_BROKEN);
  296. string.LoadString(IDS_AWS_BROKEN_DISCONNECT);
  297. pComboBox->AddString(string);
  298. string.LoadString(IDS_AWS_BROKEN_RESET);
  299. pComboBox->AddString(string);
  300. pComboBox->SetCurSel(m_UserConfig.fResetBroken);
  301. CheckDlgButton( IDC_AWS_BROKEN_INHERIT,
  302. m_UserConfig.fInheritResetBroken );
  303. OnClickedAwsBrokenInherit();
  304. /*
  305. * Load combo box strings and set Reconnection fields.
  306. */
  307. pComboBox = (CComboBox *)GetDlgItem(IDC_AWS_RECONNECT);
  308. string.LoadString(IDS_AWS_RECONNECT_FROM_ANY);
  309. pComboBox->AddString(string);
  310. string.LoadString(IDS_AWS_RECONNECT_FROM_THIS);
  311. pComboBox->AddString(string);
  312. pComboBox->SetCurSel(m_UserConfig.fReconnectSame);
  313. CheckDlgButton( IDC_AWS_RECONNECT_INHERIT,
  314. m_UserConfig.fInheritReconnectSame );
  315. OnClickedAwsReconnectInherit();
  316. /*
  317. * Load combo box strings and set Shadow fields.
  318. */
  319. pComboBox = (CComboBox *)GetDlgItem(IDC_AWS_SHADOW);
  320. string.LoadString(IDS_AWS_SHADOW_DISABLED);
  321. pComboBox->AddString(string);
  322. string.LoadString(IDS_AWS_SHADOW_ENABLED_ON_ON);
  323. pComboBox->AddString(string);
  324. string.LoadString(IDS_AWS_SHADOW_ENABLED_ON_OFF);
  325. pComboBox->AddString(string);
  326. string.LoadString(IDS_AWS_SHADOW_ENABLED_OFF_ON);
  327. pComboBox->AddString(string);
  328. string.LoadString(IDS_AWS_SHADOW_ENABLED_OFF_OFF);
  329. pComboBox->AddString(string);
  330. pComboBox->SetCurSel(m_UserConfig.Shadow);
  331. CheckDlgButton( IDC_AWS_SHADOW_INHERIT,
  332. m_UserConfig.fInheritShadow );
  333. if(m_Capabilities & WDC_SHADOWING) {
  334. OnClickedAwsShadowInherit();
  335. } else {
  336. GetDlgItem(IDL_AWS_SHADOW)->EnableWindow(FALSE);
  337. GetDlgItem(IDC_AWS_SHADOW)->EnableWindow(FALSE);
  338. GetDlgItem(IDC_AWS_SHADOW_INHERIT)->EnableWindow(FALSE);
  339. }
  340. /*
  341. * Process based on document's read/write state.
  342. */
  343. if ( m_bReadOnly ) {
  344. /*
  345. * Document is 'read-only': disable all dialog controls and labels
  346. * except for CANCEL and HELP buttons.
  347. */
  348. for ( i=IDL_AWS_WSSTATE; i <=IDC_AWS_SHADOW_INHERIT; i++ )
  349. GetDlgItem(i)->EnableWindow(FALSE);
  350. GetDlgItem(IDOK)->EnableWindow(FALSE);
  351. } else {
  352. /*
  353. * The document is 'read-write': set the maximum length for the edit
  354. * controls.
  355. */
  356. ((CEdit *)GetDlgItem(IDC_AWS_AUTOLOGON_USERNAME))
  357. ->LimitText(USERNAME_LENGTH);
  358. ((CEdit *)GetDlgItem(IDC_AWS_AUTOLOGON_DOMAIN))
  359. ->LimitText(DOMAIN_LENGTH);
  360. ((CEdit *)GetDlgItem(IDC_AWS_AUTOLOGON_PASSWORD))
  361. ->LimitText(PASSWORD_LENGTH);
  362. ((CEdit *)GetDlgItem(IDC_AWS_AUTOLOGON_CONFIRM_PASSWORD))
  363. ->LimitText(PASSWORD_LENGTH);
  364. ((CEdit *)GetDlgItem(IDC_AWS_INITIALPROGRAM_COMMANDLINE))
  365. ->LimitText(INITIALPROGRAM_LENGTH);
  366. ((CEdit *)GetDlgItem(IDC_AWS_INITIALPROGRAM_WORKINGDIRECTORY))
  367. ->LimitText(DIRECTORY_LENGTH);
  368. ((CEdit *)GetDlgItem(IDC_AWS_CONNECTION))
  369. ->LimitText(CONNECTION_TIME_DIGIT_MAX-1);
  370. ((CEdit *)GetDlgItem(IDC_AWS_DISCONNECTION))
  371. ->LimitText(DISCONNECTION_TIME_DIGIT_MAX-1);
  372. ((CEdit *)GetDlgItem(IDC_AWS_IDLE))
  373. ->LimitText(IDLE_TIME_DIGIT_MAX-1);
  374. /*
  375. * If this WinStation is the System Console, disable the WinStation
  376. * state fields.
  377. */
  378. if ( m_bSystemConsole )
  379. for ( i=IDL_AWS_WSSTATE; i <=IDC_AWS_WSENABLED; i++ )
  380. GetDlgItem(i)->EnableWindow(FALSE);
  381. }
  382. /*
  383. * Set all combo boxes to use the 'extended' UI.
  384. */
  385. ((CComboBox *)GetDlgItem(IDC_AWS_SECURITY_ENCRYPT))->SetExtendedUI(TRUE);
  386. ((CComboBox *)GetDlgItem(IDC_AWS_BROKEN))->SetExtendedUI(TRUE);
  387. ((CComboBox *)GetDlgItem(IDC_AWS_RECONNECT))->SetExtendedUI(TRUE);
  388. ((CComboBox *)GetDlgItem(IDC_AWS_SHADOW))->SetExtendedUI(TRUE);
  389. return(TRUE);
  390. } // end CAdvancedWinStationDlg::OnInitDialog
  391. /*******************************************************************************
  392. *
  393. * OnClickedAwsConnectionNone - CAdvancedWinStationDlg
  394. * member function: command
  395. *
  396. * Process the connection timeout field when the 'none' checkbox is
  397. * checked or unchecked.
  398. *
  399. * ENTRY:
  400. * EXIT:
  401. *
  402. ******************************************************************************/
  403. void
  404. CAdvancedWinStationDlg::OnClickedAwsConnectionNone()
  405. {
  406. if ( ((CButton *)GetDlgItem(IDC_AWS_CONNECTION_NONE))->GetCheck() ) {
  407. /*
  408. * The user checked 'none' box: blank the connection
  409. * timeout field, set to zero, and disable it.
  410. */
  411. SetDlgItemText(IDC_AWS_CONNECTION, TEXT(""));
  412. m_UserConfig.MaxConnectionTime = 0;
  413. GetDlgItem(IDL_AWS_CONNECTION)->EnableWindow(FALSE);
  414. GetDlgItem(IDC_AWS_CONNECTION)->EnableWindow(FALSE);
  415. } else {
  416. TCHAR string[CONNECTION_TIME_DIGIT_MAX];
  417. /*
  418. * The user unchecked 'none' box: enable the connection timeout
  419. * field, fill it in (default if necessary), and set focus there.
  420. */
  421. GetDlgItem(IDL_AWS_CONNECTION)->EnableWindow(TRUE);
  422. GetDlgItem(IDC_AWS_CONNECTION)->EnableWindow(TRUE);
  423. if ( !m_UserConfig.MaxConnectionTime )
  424. m_UserConfig.MaxConnectionTime =
  425. (CONNECTION_TIME_DEFAULT * TIME_RESOLUTION);
  426. wsprintf(string, TEXT("%lu"), m_UserConfig.MaxConnectionTime / TIME_RESOLUTION);
  427. SetDlgItemText(IDC_AWS_CONNECTION, string);
  428. GotoDlgCtrl(GetDlgItem(IDC_AWS_CONNECTION));
  429. }
  430. } // end CAdvancedWinStationDlg::OnClickedAwsConnectionNone
  431. /*******************************************************************************
  432. *
  433. * OnClickedAwsConnectionInherit - CAdvancedWinStationDlg
  434. * member function: command
  435. *
  436. * Process the connection timeout field when the 'inherit user config'
  437. * checkbox is checked or unchecked.
  438. *
  439. * ENTRY:
  440. * EXIT:
  441. *
  442. ******************************************************************************/
  443. void
  444. CAdvancedWinStationDlg::OnClickedAwsConnectionInherit()
  445. {
  446. if ( (m_UserConfig.fInheritMaxSessionTime =
  447. ((CButton *)GetDlgItem(IDC_AWS_CONNECTION_INHERIT))->GetCheck()) ) {
  448. /*
  449. * When 'inherit' button is checked, default to 'none'.
  450. */
  451. CheckDlgButton(IDC_AWS_CONNECTION_NONE, TRUE);
  452. OnClickedAwsConnectionNone();
  453. }
  454. GetDlgItem(IDL_AWS_CONNECTION)->
  455. EnableWindow( (m_UserConfig.fInheritMaxSessionTime ||
  456. !m_UserConfig.MaxConnectionTime) ? FALSE : TRUE );
  457. GetDlgItem(IDC_AWS_CONNECTION)->
  458. EnableWindow( (m_UserConfig.fInheritMaxSessionTime ||
  459. !m_UserConfig.MaxConnectionTime) ? FALSE : TRUE );
  460. GetDlgItem(IDC_AWS_CONNECTION_NONE)->
  461. EnableWindow(m_UserConfig.fInheritMaxSessionTime ? FALSE : TRUE);
  462. } // end CAdvancedWinStationDlg::OnClickedAwsConnectionInherit
  463. /*******************************************************************************
  464. *
  465. * OnClickedAwsDisconnectionNone - CAdvancedWinStationDlg
  466. * member function: command
  467. *
  468. * Process the disconnection timeout field when the 'none' checkbox is
  469. * checked or unchecked.
  470. *
  471. * ENTRY:
  472. * EXIT:
  473. *
  474. ******************************************************************************/
  475. void
  476. CAdvancedWinStationDlg::OnClickedAwsDisconnectionNone()
  477. {
  478. if ( ((CButton *)GetDlgItem(IDC_AWS_DISCONNECTION_NONE))->GetCheck() ) {
  479. /*
  480. * The user checked 'none' box: blank the disconnection
  481. * timeout field, set to zero, and disable it.
  482. */
  483. SetDlgItemText(IDC_AWS_DISCONNECTION, TEXT(""));
  484. m_UserConfig.MaxDisconnectionTime = 0;
  485. GetDlgItem(IDL_AWS_DISCONNECTION)->EnableWindow(FALSE);
  486. GetDlgItem(IDC_AWS_DISCONNECTION)->EnableWindow(FALSE);
  487. } else {
  488. TCHAR string[DISCONNECTION_TIME_DIGIT_MAX];
  489. /*
  490. * The user unchecked 'none' box: enable the disconnection timeout
  491. * field, fill it in (default if necessary), and set focus there.
  492. */
  493. GetDlgItem(IDL_AWS_DISCONNECTION)->EnableWindow(TRUE);
  494. GetDlgItem(IDC_AWS_DISCONNECTION)->EnableWindow(TRUE);
  495. if ( !m_UserConfig.MaxDisconnectionTime )
  496. m_UserConfig.MaxDisconnectionTime =
  497. (DISCONNECTION_TIME_DEFAULT * TIME_RESOLUTION);
  498. wsprintf(string, TEXT("%lu"), m_UserConfig.MaxDisconnectionTime / TIME_RESOLUTION);
  499. SetDlgItemText(IDC_AWS_DISCONNECTION, string);
  500. GotoDlgCtrl(GetDlgItem(IDC_AWS_DISCONNECTION));
  501. }
  502. } // end CAdvancedWinStationDlg::OnClickedAwsDisconnectionNone
  503. /*******************************************************************************
  504. *
  505. * OnClickedAwsDisconnectionInherit - CAdvancedWinStationDlg
  506. * member function: command
  507. *
  508. * Process the disconnection timeout field when the 'inherit user config'
  509. * checkbox is checked or unchecked.
  510. *
  511. * ENTRY:
  512. * EXIT:
  513. *
  514. ******************************************************************************/
  515. void
  516. CAdvancedWinStationDlg::OnClickedAwsDisconnectionInherit()
  517. {
  518. if ( (m_UserConfig.fInheritMaxDisconnectionTime =
  519. ((CButton *)GetDlgItem(IDC_AWS_DISCONNECTION_INHERIT))->GetCheck()) ) {
  520. /*
  521. * When 'inherit' button is checked, default to 'none'.
  522. */
  523. CheckDlgButton(IDC_AWS_DISCONNECTION_NONE, TRUE);
  524. OnClickedAwsDisconnectionNone();
  525. }
  526. GetDlgItem(IDL_AWS_DISCONNECTION)->
  527. EnableWindow( (m_UserConfig.fInheritMaxDisconnectionTime ||
  528. !m_UserConfig.MaxDisconnectionTime) ? FALSE : TRUE );
  529. GetDlgItem(IDC_AWS_DISCONNECTION)->
  530. EnableWindow( (m_UserConfig.fInheritMaxDisconnectionTime ||
  531. !m_UserConfig.MaxDisconnectionTime) ? FALSE : TRUE );
  532. GetDlgItem(IDC_AWS_DISCONNECTION_NONE)->
  533. EnableWindow(m_UserConfig.fInheritMaxDisconnectionTime ? FALSE : TRUE);
  534. } // end CAdvancedWinStationDlg::OnClickedAwsDisconnectionInherit
  535. /*******************************************************************************
  536. *
  537. * OnClickedAwsIdleNone - CAdvancedWinStationDlg member function: command
  538. *
  539. * Process the idle timeout field when the 'none' checkbox is
  540. * checked or unchecked.
  541. *
  542. * ENTRY:
  543. * EXIT:
  544. *
  545. ******************************************************************************/
  546. void
  547. CAdvancedWinStationDlg::OnClickedAwsIdleNone()
  548. {
  549. if ( ((CButton *)GetDlgItem(IDC_AWS_IDLE_NONE))->GetCheck() ) {
  550. /*
  551. * The user checked 'none' box: blank the idle
  552. * timeout field, set to zero, and disable it.
  553. */
  554. SetDlgItemText(IDC_AWS_IDLE, TEXT(""));
  555. m_UserConfig.MaxIdleTime = 0;
  556. GetDlgItem(IDL_AWS_IDLE)->EnableWindow(FALSE);
  557. GetDlgItem(IDC_AWS_IDLE)->EnableWindow(FALSE);
  558. } else {
  559. TCHAR string[IDLE_TIME_DIGIT_MAX];
  560. /*
  561. * The user unchecked 'none' box: enable the idle timeout
  562. * field, fill it in (default if necessary), and set focus there.
  563. */
  564. GetDlgItem(IDL_AWS_IDLE)->EnableWindow(TRUE);
  565. GetDlgItem(IDC_AWS_IDLE)->EnableWindow(TRUE);
  566. if ( !m_UserConfig.MaxIdleTime )
  567. m_UserConfig.MaxIdleTime =
  568. (IDLE_TIME_DEFAULT * TIME_RESOLUTION);
  569. wsprintf(string, TEXT("%lu"), m_UserConfig.MaxIdleTime / TIME_RESOLUTION);
  570. SetDlgItemText(IDC_AWS_IDLE, string);
  571. GotoDlgCtrl(GetDlgItem(IDC_AWS_IDLE));
  572. }
  573. } // end CAdvancedWinStationDlg::OnClickedAwsIdleNone
  574. /*******************************************************************************
  575. *
  576. * OnClickedAwsIdleInherit - CAdvancedWinStationDlg member function: command
  577. *
  578. * Process the idle timeout field when the 'inherit user config' checkbox
  579. * is checked or unchecked.
  580. *
  581. * ENTRY:
  582. * EXIT:
  583. *
  584. ******************************************************************************/
  585. void
  586. CAdvancedWinStationDlg::OnClickedAwsIdleInherit()
  587. {
  588. if ( (m_UserConfig.fInheritMaxIdleTime =
  589. ((CButton *)GetDlgItem(IDC_AWS_IDLE_INHERIT))->GetCheck()) ) {
  590. /*
  591. * When 'inherit' button is checked, default to 'none'.
  592. */
  593. CheckDlgButton(IDC_AWS_IDLE_NONE, TRUE);
  594. OnClickedAwsIdleNone();
  595. }
  596. GetDlgItem(IDL_AWS_IDLE)->
  597. EnableWindow( (m_UserConfig.fInheritMaxIdleTime ||
  598. !m_UserConfig.MaxIdleTime) ? FALSE : TRUE );
  599. GetDlgItem(IDC_AWS_IDLE)->
  600. EnableWindow( (m_UserConfig.fInheritMaxIdleTime ||
  601. !m_UserConfig.MaxIdleTime) ? FALSE : TRUE );
  602. GetDlgItem(IDC_AWS_IDLE_NONE)->
  603. EnableWindow(m_UserConfig.fInheritMaxIdleTime ? FALSE : TRUE);
  604. } // end CAdvancedWinStationDlg::OnClickedAwsIdleInherit
  605. /*******************************************************************************
  606. *
  607. * OnClickedAwsAutologonInherit - CAdvancedWinStationDlg
  608. * member function: command
  609. *
  610. * Process the auto logon fields when the 'inherit client config' checkbox\
  611. * is checked or unchecked.
  612. *
  613. * ENTRY:
  614. * EXIT:
  615. *
  616. ******************************************************************************/
  617. void
  618. CAdvancedWinStationDlg::OnClickedAwsAutologonInherit()
  619. {
  620. if ( (m_UserConfig.fInheritAutoLogon =
  621. ((CButton *)GetDlgItem(IDC_AWS_AUTOLOGON_INHERIT))->GetCheck()) ) {
  622. /*
  623. * When 'inherit' button is checked, default fields to empty.
  624. */
  625. memset(m_UserConfig.UserName, 0, sizeof(m_UserConfig.UserName));
  626. memset(m_UserConfig.Domain, 0, sizeof(m_UserConfig.Domain));
  627. memset(m_UserConfig.Password, 0, sizeof(m_UserConfig.Password));
  628. }
  629. SetDlgItemText(IDC_AWS_AUTOLOGON_USERNAME, m_UserConfig.UserName);
  630. SetDlgItemText(IDC_AWS_AUTOLOGON_DOMAIN, m_UserConfig.Domain);
  631. SetDlgItemText(IDC_AWS_AUTOLOGON_PASSWORD, m_UserConfig.Password);
  632. SetDlgItemText(IDC_AWS_AUTOLOGON_CONFIRM_PASSWORD, m_UserConfig.Password);
  633. GetDlgItem(IDL_AWS_AUTOLOGON_USERNAME)->
  634. EnableWindow(m_UserConfig.fInheritAutoLogon ? FALSE : TRUE);
  635. GetDlgItem(IDC_AWS_AUTOLOGON_USERNAME)->
  636. EnableWindow(m_UserConfig.fInheritAutoLogon ? FALSE : TRUE);
  637. GetDlgItem(IDL_AWS_AUTOLOGON_DOMAIN)->
  638. EnableWindow(m_UserConfig.fInheritAutoLogon ? FALSE : TRUE);
  639. GetDlgItem(IDC_AWS_AUTOLOGON_DOMAIN)->
  640. EnableWindow(m_UserConfig.fInheritAutoLogon ? FALSE : TRUE);
  641. GetDlgItem(IDL_AWS_AUTOLOGON_PASSWORD)->
  642. EnableWindow((!m_UserConfig.fInheritAutoLogon && !m_UserConfig.fPromptForPassword));
  643. GetDlgItem(IDC_AWS_AUTOLOGON_PASSWORD)->
  644. EnableWindow((!m_UserConfig.fInheritAutoLogon && !m_UserConfig.fPromptForPassword));
  645. GetDlgItem(IDL_AWS_AUTOLOGON_CONFIRM_PASSWORD)->
  646. EnableWindow((!m_UserConfig.fInheritAutoLogon && !m_UserConfig.fPromptForPassword));
  647. GetDlgItem(IDC_AWS_AUTOLOGON_CONFIRM_PASSWORD)->
  648. EnableWindow((!m_UserConfig.fInheritAutoLogon && !m_UserConfig.fPromptForPassword));
  649. if(!m_UserConfig.fInheritAutoLogon)
  650. GetDlgItem(IDC_AWS_AUTOLOGON_USERNAME)->SetFocus();
  651. } // end CAdvancedWinStationDlg::OnClickedAwsAutologonInherit
  652. /*******************************************************************************
  653. *
  654. * OnClickedAwsPromptforPassword - CAdvancedWinStationDlg
  655. * member function: command
  656. *
  657. * Process the auto logon fields when the 'Prompt for password' checkbox\
  658. * is checked or unchecked.
  659. *
  660. * ENTRY:
  661. * EXIT:
  662. *
  663. ******************************************************************************/
  664. void
  665. CAdvancedWinStationDlg::OnClickedAwsPromptForPassword()
  666. {
  667. if ( (m_UserConfig.fPromptForPassword =
  668. ((CButton *)GetDlgItem(IDC_AWS_AUTOLOGON_PASSWORD_PROMPT))->GetCheck()) ) {
  669. /*
  670. * When 'Prompt for Password' button is checked, default password field to empty.
  671. */
  672. memset(m_UserConfig.Password, 0, sizeof(m_UserConfig.Password));
  673. }
  674. if(m_UserConfig.fInheritAutoLogon)
  675. return;
  676. SetDlgItemText(IDC_AWS_AUTOLOGON_PASSWORD, m_UserConfig.Password);
  677. SetDlgItemText(IDC_AWS_AUTOLOGON_CONFIRM_PASSWORD, m_UserConfig.Password);
  678. GetDlgItem(IDL_AWS_AUTOLOGON_PASSWORD)->
  679. EnableWindow(m_UserConfig.fPromptForPassword ? FALSE : TRUE);
  680. GetDlgItem(IDC_AWS_AUTOLOGON_PASSWORD)->
  681. EnableWindow(m_UserConfig.fPromptForPassword ? FALSE : TRUE);
  682. GetDlgItem(IDL_AWS_AUTOLOGON_CONFIRM_PASSWORD)->
  683. EnableWindow(m_UserConfig.fPromptForPassword ? FALSE : TRUE);
  684. GetDlgItem(IDC_AWS_AUTOLOGON_CONFIRM_PASSWORD)->
  685. EnableWindow(m_UserConfig.fPromptForPassword ? FALSE : TRUE);
  686. } // end CAdvancedWinStationDlg::OnClickedAwsPromptforPassword
  687. /*******************************************************************************
  688. *
  689. * OnClickedAwsInitialprogramInherit - CAdvancedWinStationDlg
  690. * member function: command
  691. *
  692. * Process the initial program fields when the 'inherit client/user config'
  693. * checkbox is checked or unchecked.
  694. *
  695. * ENTRY:
  696. * EXIT:
  697. *
  698. ******************************************************************************/
  699. void
  700. CAdvancedWinStationDlg::OnClickedAwsInitialprogramInherit()
  701. {
  702. if ( (m_UserConfig.fInheritInitialProgram =
  703. ((CButton *)GetDlgItem(IDC_AWS_INITIALPROGRAM_INHERIT))->GetCheck()) ) {
  704. /*
  705. * When 'inherit' button is checked, default fields to empty.
  706. */
  707. memset(m_UserConfig.InitialProgram, 0, sizeof(m_UserConfig.InitialProgram));
  708. memset(m_UserConfig.WorkDirectory, 0, sizeof(m_UserConfig.WorkDirectory));
  709. } else {
  710. /*
  711. * When 'inherit' button is unchecked, set 'published only' to 'off'.
  712. */
  713. CheckDlgButton( IDC_AWS_INITIALPROGRAM_PUBLISHEDONLY,
  714. m_UserConfig.fDisableExe = FALSE );
  715. }
  716. SetDlgItemText(IDC_AWS_INITIALPROGRAM_COMMANDLINE, m_UserConfig.InitialProgram);
  717. SetDlgItemText(IDC_AWS_INITIALPROGRAM_WORKINGDIRECTORY, m_UserConfig.WorkDirectory);
  718. GetDlgItem(IDL_AWS_INITIALPROGRAM_COMMANDLINE1)->
  719. EnableWindow(m_UserConfig.fInheritInitialProgram ? FALSE : TRUE);
  720. GetDlgItem(IDL_AWS_INITIALPROGRAM_COMMANDLINE2)->
  721. EnableWindow(m_UserConfig.fInheritInitialProgram ? FALSE : TRUE);
  722. GetDlgItem(IDC_AWS_INITIALPROGRAM_COMMANDLINE)->
  723. EnableWindow(m_UserConfig.fInheritInitialProgram ? FALSE : TRUE);
  724. GetDlgItem(IDL_AWS_INITIALPROGRAM_WORKINGDIRECTORY1)->
  725. EnableWindow(m_UserConfig.fInheritInitialProgram ? FALSE : TRUE);
  726. GetDlgItem(IDL_AWS_INITIALPROGRAM_WORKINGDIRECTORY2)->
  727. EnableWindow(m_UserConfig.fInheritInitialProgram ? FALSE : TRUE);
  728. GetDlgItem(IDC_AWS_INITIALPROGRAM_WORKINGDIRECTORY)->
  729. EnableWindow(m_UserConfig.fInheritInitialProgram ? FALSE : TRUE);
  730. if(!(m_Capabilities & WDC_PUBLISHED_APPLICATIONS)) {
  731. GetDlgItem(IDC_AWS_INITIALPROGRAM_PUBLISHEDONLY)->EnableWindow(FALSE);
  732. } else {
  733. GetDlgItem(IDC_AWS_INITIALPROGRAM_PUBLISHEDONLY)->
  734. EnableWindow(m_UserConfig.fInheritInitialProgram ? TRUE : FALSE);
  735. }
  736. } // end CAdvancedWinStationDlg::OnClickedAwsInitialprogramInherit
  737. /*******************************************************************************
  738. *
  739. * OnClickedAwsInitialprogramPublishedonly - CAdvancedWinStationDlg
  740. * member function: command
  741. *
  742. * Set the state of fDisableExe flag when 'Only run Published
  743. * Applications' checkbox is clicked.
  744. *
  745. * ENTRY:
  746. * EXIT:
  747. *
  748. ******************************************************************************/
  749. void
  750. CAdvancedWinStationDlg::OnClickedAwsInitialprogramPublishedonly()
  751. {
  752. m_UserConfig.fDisableExe =
  753. ((CButton *)GetDlgItem(IDC_AWS_INITIALPROGRAM_PUBLISHEDONLY))->GetCheck();
  754. } // end CAdvancedWinStationDlg::OnClickedAwsInitialprogramPublishedonly
  755. /*******************************************************************************
  756. *
  757. * OnClickedAwsSecurityDisableencryption -
  758. * CAdvancedWinStationDlg member function: command
  759. *
  760. * Set the state of fDisableEncryption flag when 'Disable encryption after
  761. * Logon' checkbox is clicked.
  762. *
  763. * ENTRY:
  764. * EXIT:
  765. *
  766. ******************************************************************************/
  767. void
  768. CAdvancedWinStationDlg::OnClickedAwsSecurityDisableencryption()
  769. {
  770. // m_UserConfig.fDisableEncryption =
  771. // ((CButton *)GetDlgItem(IDC_AWS_SECURITY_DISABLEENCRYPTION))->GetCheck();
  772. } // end CAdvancedWinStationDlg::OnClickedAwsSecurityDisableencryption
  773. /*******************************************************************************
  774. *
  775. * OnClickedAwsUseroverrideDisablewallpaper -
  776. * CAdvancedWinStationDlg member function: command
  777. *
  778. * Set the state of fWallPaperDisabled flag when 'Disable Wallpaper'
  779. * checkbox is clicked.
  780. *
  781. * ENTRY:
  782. * EXIT:
  783. *
  784. ******************************************************************************/
  785. void
  786. CAdvancedWinStationDlg::OnClickedAwsUseroverrideDisablewallpaper()
  787. {
  788. m_UserConfig.fWallPaperDisabled =
  789. ((CButton *)GetDlgItem(IDC_AWS_USEROVERRIDE_DISABLEWALLPAPER))->GetCheck();
  790. } // end CAdvancedWinStationDlg::OnClickedAwsUseroverrideDisablewallpaper
  791. /*******************************************************************************
  792. *
  793. * OnClickedAwsBrokenInherit - CAdvancedWinStationDlg member function: command
  794. *
  795. * Process the broken connection fields when the 'user specified'
  796. * checkbox is checked or unchecked.
  797. *
  798. * ENTRY:
  799. * EXIT:
  800. *
  801. ******************************************************************************/
  802. void
  803. CAdvancedWinStationDlg::OnClickedAwsBrokenInherit()
  804. {
  805. m_UserConfig.fInheritResetBroken =
  806. ((CButton *)GetDlgItem(IDC_AWS_BROKEN_INHERIT))->GetCheck();
  807. GetDlgItem(IDL_AWS_BROKEN1)->
  808. EnableWindow(m_UserConfig.fInheritResetBroken ? FALSE : TRUE);
  809. GetDlgItem(IDC_AWS_BROKEN)->
  810. EnableWindow(m_UserConfig.fInheritResetBroken ? FALSE : TRUE);
  811. GetDlgItem(IDL_AWS_BROKEN2)->
  812. EnableWindow(m_UserConfig.fInheritResetBroken ? FALSE : TRUE);
  813. } // end CAdvancedWinStationDlg::OnClickedAwsBrokenInherit
  814. /*******************************************************************************
  815. *
  816. * OnClickedAwsReconnectInherit - CAdvancedWinStationDlg
  817. * member function: command
  818. *
  819. * Process the reconnect sessions fields when the 'user specified'
  820. * checkbox is checked or unchecked.
  821. *
  822. * ENTRY:
  823. * EXIT:
  824. *
  825. ******************************************************************************/
  826. void
  827. CAdvancedWinStationDlg::OnClickedAwsReconnectInherit()
  828. {
  829. m_UserConfig.fInheritReconnectSame =
  830. ((CButton *)GetDlgItem(IDC_AWS_RECONNECT_INHERIT))->GetCheck();
  831. GetDlgItem(IDL_AWS_RECONNECT1)->
  832. EnableWindow(m_UserConfig.fInheritReconnectSame ? FALSE : TRUE);
  833. GetDlgItem(IDC_AWS_RECONNECT)->
  834. EnableWindow(m_UserConfig.fInheritReconnectSame ? FALSE : TRUE);
  835. } // end CAdvancedWinStationDlg::OnClickedAwsReconnectInherit
  836. /*******************************************************************************
  837. *
  838. * OnClickedAwsShadowInherit - CAdvancedWinStationDlg member function: command
  839. *
  840. * Process the shadowing fields when the 'user specified' checkbox is
  841. * checked or unchecked.
  842. *
  843. * ENTRY:
  844. * EXIT:
  845. *
  846. ******************************************************************************/
  847. void
  848. CAdvancedWinStationDlg::OnClickedAwsShadowInherit()
  849. {
  850. m_UserConfig.fInheritShadow =
  851. ((CButton *)GetDlgItem(IDC_AWS_SHADOW_INHERIT))->GetCheck();
  852. GetDlgItem(IDL_AWS_SHADOW)->
  853. EnableWindow(m_UserConfig.fInheritShadow ? FALSE : TRUE);
  854. GetDlgItem(IDC_AWS_SHADOW)->
  855. EnableWindow(m_UserConfig.fInheritShadow ? FALSE : TRUE);
  856. } // end CAdvancedWinStationDlg::OnClickedAwsShadowInherit
  857. /*******************************************************************************
  858. *
  859. * OnOK - CAdvancedWinStationDlg member function: command (override)
  860. *
  861. * Read all control contents back into the dialog's member variables
  862. * before closing the dialog.
  863. *
  864. * ENTRY:
  865. * EXIT:
  866. * (Refer to CDialog::OnOk documentation)
  867. *
  868. ******************************************************************************/
  869. void
  870. CAdvancedWinStationDlg::OnOK()
  871. {
  872. /*
  873. * If the Enter key was pressed while a combo box was dropped down, ignore
  874. * it (treat as combo list selection only).
  875. */
  876. if ( !HandleEnterEscKey(IDOK) )
  877. return;
  878. /*
  879. * Get WinStation state.
  880. */
  881. m_fEnableWinStation =
  882. (GetCheckedRadioButton( IDC_AWS_WSDISABLED, IDC_AWS_WSENABLED )
  883. - IDC_AWS_WSDISABLED );
  884. /*
  885. * Get Connection Timeout settings.
  886. */
  887. if ( IsDlgButtonChecked(IDC_AWS_CONNECTION_NONE) ) {
  888. m_UserConfig.MaxConnectionTime = 0;
  889. } else {
  890. TCHAR string[CONNECTION_TIME_DIGIT_MAX], *endptr;
  891. ULONG ul;
  892. GetDlgItemText(IDC_AWS_CONNECTION, string, lengthof(string));
  893. ul = lstrtoul(string, &endptr, 10);
  894. if ( (*endptr != TEXT('\0')) ||
  895. (ul < CONNECTION_TIME_MIN) || (ul > CONNECTION_TIME_MAX) ) {
  896. ERROR_MESSAGE(( IDP_INVALID_CONNECTIONTIMEOUT,
  897. CONNECTION_TIME_MIN, CONNECTION_TIME_MAX ))
  898. GotoDlgCtrl(GetDlgItem(IDC_AWS_CONNECTION));
  899. return;
  900. } else
  901. m_UserConfig.MaxConnectionTime = ul * TIME_RESOLUTION;
  902. }
  903. m_UserConfig.fInheritMaxSessionTime =
  904. IsDlgButtonChecked(IDC_AWS_CONNECTION_INHERIT);
  905. /*
  906. * Get Disconnection Timeout settings.
  907. */
  908. if ( IsDlgButtonChecked(IDC_AWS_DISCONNECTION_NONE) ) {
  909. m_UserConfig.MaxDisconnectionTime = 0;
  910. } else {
  911. TCHAR string[DISCONNECTION_TIME_DIGIT_MAX], *endptr;
  912. ULONG ul;
  913. GetDlgItemText(IDC_AWS_DISCONNECTION, string, lengthof(string));
  914. ul = lstrtoul(string, &endptr, 10);
  915. if ( (*endptr != TEXT('\0')) ||
  916. (ul < DISCONNECTION_TIME_MIN) || (ul > DISCONNECTION_TIME_MAX) ) {
  917. ERROR_MESSAGE(( IDP_INVALID_DISCONNECTIONTIMEOUT,
  918. DISCONNECTION_TIME_MIN, DISCONNECTION_TIME_MAX ))
  919. GotoDlgCtrl(GetDlgItem(IDC_AWS_DISCONNECTION));
  920. return;
  921. } else
  922. m_UserConfig.MaxDisconnectionTime = ul * TIME_RESOLUTION;
  923. }
  924. m_UserConfig.fInheritMaxDisconnectionTime =
  925. IsDlgButtonChecked(IDC_AWS_DISCONNECTION_INHERIT);
  926. /*
  927. * Get Idle Timeout settings.
  928. */
  929. if ( IsDlgButtonChecked(IDC_AWS_IDLE_NONE) ) {
  930. m_UserConfig.MaxIdleTime = 0;
  931. } else {
  932. TCHAR string[IDLE_TIME_DIGIT_MAX], *endptr;
  933. ULONG ul;
  934. GetDlgItemText(IDC_AWS_IDLE, string, lengthof(string));
  935. ul = lstrtoul(string, &endptr, 10);
  936. if ( (*endptr != TEXT('\0')) ||
  937. (ul < IDLE_TIME_MIN) || (ul > IDLE_TIME_MAX) ) {
  938. ERROR_MESSAGE(( IDP_INVALID_IDLETIMEOUT,
  939. IDLE_TIME_MIN, IDLE_TIME_MAX ))
  940. GotoDlgCtrl(GetDlgItem(IDC_AWS_IDLE));
  941. return;
  942. } else
  943. m_UserConfig.MaxIdleTime = ul * TIME_RESOLUTION;
  944. }
  945. m_UserConfig.fInheritMaxIdleTime = IsDlgButtonChecked(IDC_AWS_IDLE_INHERIT);
  946. /*
  947. * Get and check AutoLogon password text settings.
  948. */
  949. {
  950. TCHAR szConfirmPassword[PASSWORD_LENGTH+1];
  951. GetDlgItemText( IDC_AWS_AUTOLOGON_PASSWORD, m_UserConfig.Password,
  952. lengthof(m_UserConfig.Password) );
  953. GetDlgItemText( IDC_AWS_AUTOLOGON_CONFIRM_PASSWORD, szConfirmPassword,
  954. lengthof(szConfirmPassword) );
  955. if ( lstrcmp(m_UserConfig.Password, szConfirmPassword) ) {
  956. ERROR_MESSAGE((IDP_INVALID_PASSWORDS_DONT_MATCH))
  957. GotoDlgCtrl(GetDlgItem(IDC_AWS_AUTOLOGON_PASSWORD));
  958. return;
  959. }
  960. }
  961. /*
  962. * Get other AutoLogon settings.
  963. */
  964. GetDlgItemText( IDC_AWS_AUTOLOGON_USERNAME, m_UserConfig.UserName,
  965. lengthof(m_UserConfig.UserName) );
  966. GetDlgItemText( IDC_AWS_AUTOLOGON_DOMAIN, m_UserConfig.Domain,
  967. lengthof(m_UserConfig.Domain) );
  968. m_UserConfig.fPromptForPassword =
  969. IsDlgButtonChecked(IDC_AWS_AUTOLOGON_PASSWORD_PROMPT);
  970. /*
  971. * Get Initial Program settings.
  972. */
  973. GetDlgItemText( IDC_AWS_INITIALPROGRAM_COMMANDLINE,
  974. m_UserConfig.InitialProgram,
  975. lengthof(m_UserConfig.InitialProgram) );
  976. GetDlgItemText( IDC_AWS_INITIALPROGRAM_WORKINGDIRECTORY,
  977. m_UserConfig.WorkDirectory,
  978. lengthof(m_UserConfig.WorkDirectory) );
  979. /*
  980. * Get encryption level, broken connection, reconnect, and shadow settings.
  981. */
  982. if(m_pEncryptionLevels) {
  983. m_UserConfig.MinEncryptionLevel =
  984. (BYTE)m_pEncryptionLevels[((CComboBox *)GetDlgItem(IDC_AWS_SECURITY_ENCRYPT))->GetCurSel()].RegistryValue;
  985. }
  986. m_UserConfig.fUseDefaultGina =
  987. IsDlgButtonChecked(IDC_AWS_SECURITY_DEFAULTGINA);
  988. m_UserConfig.fResetBroken =
  989. ((CComboBox *)GetDlgItem(IDC_AWS_BROKEN))->GetCurSel();
  990. m_UserConfig.fReconnectSame =
  991. ((CComboBox *)GetDlgItem(IDC_AWS_RECONNECT))->GetCurSel();
  992. m_UserConfig.Shadow =
  993. (SHADOWCLASS)((CComboBox *)GetDlgItem(IDC_AWS_SHADOW))->GetCurSel();
  994. /*
  995. * Call the parent classes' OnOk to complete dialog closing
  996. * and destruction.
  997. */
  998. CBaseDialog::OnOK();
  999. } // end CAdvancedWinStationDlg::OnOk
  1000. /*******************************************************************************
  1001. *
  1002. * OnCancel - CAdvancedWinStationDlg member function: command (override)
  1003. *
  1004. * Cancel dialog.
  1005. *
  1006. * ENTRY:
  1007. * EXIT:
  1008. * (Refer to CDialog::OnCancel documentation)
  1009. *
  1010. ******************************************************************************/
  1011. void
  1012. CAdvancedWinStationDlg::OnCancel()
  1013. {
  1014. /*
  1015. * If the Esc key was pressed while a combo box was dropped down, ignore
  1016. * it (treat as combo close-up and cancel only).
  1017. */
  1018. if ( !HandleEnterEscKey(IDCANCEL) )
  1019. return;
  1020. /*
  1021. * Call the parent classes' OnCancel to complete dialog closing
  1022. * and destruction.
  1023. */
  1024. CBaseDialog::OnCancel();
  1025. } // end CAdvancedWinStationDlg::OnCancel
  1026. ////////////////////////////////////////////////////////////////////////////////
  1027. ////////////////////////////////////////////////////////////////////////////////
  1028. // CClientSettingsDlg class construction / destruction, implementation
  1029. /*******************************************************************************
  1030. *
  1031. * CClientSettingsDlg - CClientSettingsDlg constructor
  1032. *
  1033. * ENTRY:
  1034. * EXIT:
  1035. * (Refer to MFC CDialog::CDialog documentation)
  1036. *
  1037. ******************************************************************************/
  1038. CClientSettingsDlg::CClientSettingsDlg()
  1039. : CBaseDialog(CClientSettingsDlg::IDD)
  1040. {
  1041. //{{AFX_DATA_INIT(CClientSettingsDlg)
  1042. // NOTE: the ClassWizard will add member initialization here
  1043. //}}AFX_DATA_INIT
  1044. } // end CClientSettingsDlg::CClientSettingsDlg
  1045. ////////////////////////////////////////////////////////////////////////////////
  1046. // CClientSettingsDlg operations
  1047. ////////////////////////////////////////////////////////////////////////////////
  1048. // CClientSettingsDlg message map
  1049. BEGIN_MESSAGE_MAP(CClientSettingsDlg, CBaseDialog)
  1050. //{{AFX_MSG_MAP(CClientSettingsDlg)
  1051. ON_BN_CLICKED(IDC_CS_CONNECTION_DRIVES, OnClickedCsClientdevicesDrives)
  1052. ON_BN_CLICKED(IDC_CS_CONNECTION_PRINTERS, OnClickedCsClientdevicesPrinters)
  1053. ON_BN_CLICKED(IDC_CS_CONNECTION_INHERIT, OnClickedCsClientdevicesInherit)
  1054. ON_BN_CLICKED(IDC_CS_CONNECTION_FORCEPRTDEF, OnClickedCsClientdevicesForceprtdef)
  1055. ON_BN_CLICKED(IDC_CS_MAPPING_DRIVES, OnClickedCsMappingDrives)
  1056. ON_BN_CLICKED(IDC_CS_MAPPING_WINDOWSPRINTERS, OnClickedCsMappingWindowsprinters)
  1057. ON_BN_CLICKED(IDC_CS_MAPPING_DOSLPTS, OnClickedCsMappingDoslpts)
  1058. ON_BN_CLICKED(IDC_CS_MAPPING_COMPORTS, OnClickedCsMappingComports)
  1059. ON_BN_CLICKED(IDC_CS_MAPPING_CLIPBOARD, OnClickedCsMappingClipboard)
  1060. ON_BN_CLICKED(IDC_CS_MAPPING_AUDIO, OnClickedCsMappingAudio)
  1061. //}}AFX_MSG_MAP
  1062. END_MESSAGE_MAP()
  1063. ////////////////////////////////////////////////////////////////////////////////
  1064. // CClientSettingsDlg commands
  1065. /*******************************************************************************
  1066. *
  1067. * OnInitDialog - CClientSettingsDlg member function: command (override)
  1068. *
  1069. * Performs the dialog intialization.
  1070. *
  1071. * ENTRY:
  1072. * EXIT:
  1073. * (Refer to CDialog::OnInitDialog documentation)
  1074. *
  1075. ******************************************************************************/
  1076. BOOL
  1077. CClientSettingsDlg::OnInitDialog()
  1078. {
  1079. int i;
  1080. /*
  1081. * Call the parent classes' OnInitDialog to perform default dialog
  1082. * initialization.
  1083. */
  1084. CBaseDialog::OnInitDialog();
  1085. /*
  1086. * Set Connection fields.
  1087. */
  1088. CheckDlgButton( IDC_CS_CONNECTION_DRIVES,
  1089. m_UserConfig.fAutoClientDrives );
  1090. CheckDlgButton( IDC_CS_CONNECTION_PRINTERS,
  1091. m_UserConfig.fAutoClientLpts );
  1092. CheckDlgButton( IDC_CS_CONNECTION_FORCEPRTDEF,
  1093. m_UserConfig.fForceClientLptDef );
  1094. CheckDlgButton( IDC_CS_CONNECTION_INHERIT,
  1095. m_UserConfig.fInheritAutoClient );
  1096. /*
  1097. * Set Mapping Override fields.
  1098. */
  1099. CheckDlgButton( IDC_CS_MAPPING_DRIVES,
  1100. m_UserConfig.fDisableCdm );
  1101. CheckDlgButton( IDC_CS_MAPPING_WINDOWSPRINTERS,
  1102. m_UserConfig.fDisableCpm );
  1103. CheckDlgButton( IDC_CS_MAPPING_DOSLPTS,
  1104. m_UserConfig.fDisableLPT );
  1105. CheckDlgButton( IDC_CS_MAPPING_COMPORTS,
  1106. m_UserConfig.fDisableCcm );
  1107. CheckDlgButton( IDC_CS_MAPPING_CLIPBOARD,
  1108. m_UserConfig.fDisableClip );
  1109. CheckDlgButton( IDC_CS_MAPPING_AUDIO,
  1110. m_UserConfig.fDisableCam );
  1111. /*
  1112. * Set proper control states based on selections.
  1113. */
  1114. OnClickedCsClientdevicesInherit();
  1115. /*
  1116. * Process based on document's read/write state.
  1117. */
  1118. if ( m_bReadOnly ) {
  1119. /*
  1120. * Document is 'read-only': disable all dialog controls and labels
  1121. * except for CANCEL and HELP buttons.
  1122. */
  1123. for ( i=IDL_CS_CONNECTION; i <=IDC_CS_MAPPING_AUDIO; i++ )
  1124. GetDlgItem(i)->EnableWindow(FALSE);
  1125. GetDlgItem(IDOK)->EnableWindow(FALSE);
  1126. } else {
  1127. /*
  1128. * Enable/Disable Controls based on capabilities of the Wd
  1129. */
  1130. GetDlgItem(IDC_CS_MAPPING_DRIVES)->EnableWindow((m_Capabilities & WDC_CLIENT_DRIVE_MAPPING) > 0);
  1131. GetDlgItem(IDC_CS_MAPPING_WINDOWSPRINTERS)->EnableWindow((m_Capabilities & WDC_WIN_CLIENT_PRINTER_MAPPING) > 0);
  1132. GetDlgItem(IDC_CS_MAPPING_DOSLPTS)->EnableWindow((m_Capabilities & WDC_CLIENT_LPT_PORT_MAPPING) > 0);
  1133. GetDlgItem(IDC_CS_MAPPING_COMPORTS)->EnableWindow((m_Capabilities & WDC_CLIENT_COM_PORT_MAPPING) > 0);
  1134. GetDlgItem(IDC_CS_MAPPING_CLIPBOARD)->EnableWindow((m_Capabilities & WDC_CLIENT_CLIPBOARD_MAPPING) > 0);
  1135. GetDlgItem(IDC_CS_MAPPING_AUDIO)->EnableWindow((m_Capabilities & WDC_CLIENT_AUDIO_MAPPING) > 0);
  1136. GetDlgItem(IDC_CS_CONNECTION_INHERIT)->EnableWindow((m_Capabilities & WDC_CLIENT_CONNECT_MASK) > 0);
  1137. }
  1138. return(TRUE);
  1139. } // end CClientSettingsDlg::OnInitDialog
  1140. /*******************************************************************************
  1141. *
  1142. * OnClickedCsClientdevicesDrives -
  1143. * CClientSettingsDlg member function: command
  1144. *
  1145. * Set the state of fAutoClientDrives flag when 'Connect client drives at
  1146. * Logon' checkbox is clicked.
  1147. *
  1148. * ENTRY:
  1149. * EXIT:
  1150. *
  1151. ******************************************************************************/
  1152. void
  1153. CClientSettingsDlg::OnClickedCsClientdevicesDrives()
  1154. {
  1155. m_UserConfig.fAutoClientDrives =
  1156. ((CButton *)GetDlgItem(IDC_CS_CONNECTION_DRIVES))->GetCheck();
  1157. } // end CClientSettingsDlg::OnClickedCsClientdevicesDrives
  1158. /*******************************************************************************
  1159. *
  1160. * OnClickedCsClientdevicesPrinters -
  1161. * CClientSettingsDlg member function: command
  1162. *
  1163. * Set the state of fAutoClientLpts flag when 'Connect client LPTs at
  1164. * Logon' checkbox is clicked.
  1165. *
  1166. * ENTRY:
  1167. * EXIT:
  1168. *
  1169. ******************************************************************************/
  1170. void
  1171. CClientSettingsDlg::OnClickedCsClientdevicesPrinters()
  1172. {
  1173. m_UserConfig.fAutoClientLpts =
  1174. ((CButton *)GetDlgItem(IDC_CS_CONNECTION_PRINTERS))->GetCheck();
  1175. } // end CClientSettingsDlg::OnClickedCsClientdevicesPrinters
  1176. /*******************************************************************************
  1177. *
  1178. * OnClickedCsClientdevicesForceprtdef -
  1179. * CClientSettingsDlg member function: command
  1180. *
  1181. * Set the state of fForceClientLptDef flag when 'Default to main client
  1182. * printer' checkbox is clicked.
  1183. *
  1184. * ENTRY:
  1185. * EXIT:
  1186. *
  1187. ******************************************************************************/
  1188. void
  1189. CClientSettingsDlg::OnClickedCsClientdevicesForceprtdef()
  1190. {
  1191. m_UserConfig.fForceClientLptDef =
  1192. ((CButton *)GetDlgItem(IDC_CS_CONNECTION_FORCEPRTDEF))->GetCheck();
  1193. } // end CClientSettingsDlg::OnClickedCsClientdevicesForceprtdef
  1194. /*******************************************************************************
  1195. *
  1196. * OnClickedCsClientdevicesInherit - CClientSettingsDlg
  1197. * member function: command
  1198. *
  1199. * Process the Connection fields when the 'inherit user config'
  1200. * checkbox is checked or unchecked.
  1201. *
  1202. * ENTRY:
  1203. * EXIT:
  1204. *
  1205. ******************************************************************************/
  1206. void
  1207. CClientSettingsDlg::OnClickedCsClientdevicesInherit()
  1208. {
  1209. m_UserConfig.fInheritAutoClient =
  1210. ((CButton *)GetDlgItem(IDC_CS_CONNECTION_INHERIT))->GetCheck();
  1211. if(!(m_Capabilities & WDC_CLIENT_DRIVE_MAPPING)) {
  1212. GetDlgItem(IDC_CS_CONNECTION_DRIVES)->EnableWindow(FALSE);
  1213. } else {
  1214. GetDlgItem(IDC_CS_CONNECTION_DRIVES)->
  1215. EnableWindow( (m_UserConfig.fInheritAutoClient ||
  1216. m_UserConfig.fDisableCdm) ? FALSE : TRUE );
  1217. }
  1218. if(!(m_Capabilities & (WDC_WIN_CLIENT_PRINTER_MAPPING | WDC_CLIENT_LPT_PORT_MAPPING))) {
  1219. GetDlgItem(IDC_CS_CONNECTION_PRINTERS)->EnableWindow(FALSE);
  1220. GetDlgItem(IDC_CS_CONNECTION_FORCEPRTDEF)->EnableWindow(FALSE);
  1221. } else {
  1222. GetDlgItem(IDC_CS_CONNECTION_PRINTERS)->
  1223. EnableWindow( (m_UserConfig.fInheritAutoClient ||
  1224. (m_UserConfig.fDisableCpm && m_UserConfig.fDisableLPT) ) ? FALSE : TRUE );
  1225. GetDlgItem(IDC_CS_CONNECTION_FORCEPRTDEF)->
  1226. EnableWindow( (m_UserConfig.fInheritAutoClient ||
  1227. (m_UserConfig.fDisableCpm && m_UserConfig.fDisableLPT) ) ? FALSE : TRUE );
  1228. }
  1229. } // end CClientSettingsDlg::OnClickedCsClientdevicesInherit
  1230. /*******************************************************************************
  1231. *
  1232. * OnClickedCsMappingDrives - CClientSettingsDlg member function: command
  1233. *
  1234. * Set the state of fDisableCdm flag and related controls when
  1235. * 'Disable Client Drive Mapping' checkbox is clicked.
  1236. *
  1237. * ENTRY:
  1238. * EXIT:
  1239. *
  1240. ******************************************************************************/
  1241. void
  1242. CClientSettingsDlg::OnClickedCsMappingDrives()
  1243. {
  1244. m_UserConfig.fDisableCdm =
  1245. ((CButton *)GetDlgItem(IDC_CS_MAPPING_DRIVES))->GetCheck();
  1246. OnClickedCsClientdevicesInherit();
  1247. } // end CClientSettingsDlg::OnClickedCsMappingDrives
  1248. /*******************************************************************************
  1249. *
  1250. * OnClickedCsMappingWindowsprinters - CClientSettingsDlg
  1251. * member function: command
  1252. *
  1253. * Set the state of fDisableCpm flag and related controls when
  1254. * 'Disable Windows Client Printer Mapping' checkbox is clicked.
  1255. *
  1256. * ENTRY:
  1257. * EXIT:
  1258. *
  1259. ******************************************************************************/
  1260. void
  1261. CClientSettingsDlg::OnClickedCsMappingWindowsprinters()
  1262. {
  1263. m_UserConfig.fDisableCpm =
  1264. ((CButton *)GetDlgItem(IDC_CS_MAPPING_WINDOWSPRINTERS))->GetCheck();
  1265. OnClickedCsClientdevicesInherit();
  1266. } // end CClientSettingsDlg::OnClickedCsMappingWindowsprinters
  1267. /*******************************************************************************
  1268. *
  1269. * OnClickedCsMappingDoslpts - CClientSettingsDlg member function: command
  1270. *
  1271. * Set the state of fDisableLPT flag and related controls when
  1272. * 'Disable DOS Client LPT Port Mapping' checkbox is clicked.
  1273. *
  1274. * ENTRY:
  1275. * EXIT:
  1276. *
  1277. ******************************************************************************/
  1278. void
  1279. CClientSettingsDlg::OnClickedCsMappingDoslpts()
  1280. {
  1281. m_UserConfig.fDisableLPT =
  1282. ((CButton *)GetDlgItem(IDC_CS_MAPPING_DOSLPTS))->GetCheck();
  1283. OnClickedCsClientdevicesInherit();
  1284. } // end CClientSettingsDlg::OnClickedCsMappingDoslpts
  1285. /*******************************************************************************
  1286. *
  1287. * OnClickedCsMappingComports - CClientSettingsDlg member function: command
  1288. *
  1289. * Set the state of fDisableCcm flag when 'Disable Client COM Port
  1290. * Mapping' checkbox is clicked.
  1291. *
  1292. * ENTRY:
  1293. * EXIT:
  1294. *
  1295. ******************************************************************************/
  1296. void
  1297. CClientSettingsDlg::OnClickedCsMappingComports()
  1298. {
  1299. m_UserConfig.fDisableCcm =
  1300. ((CButton *)GetDlgItem(IDC_CS_MAPPING_COMPORTS))->GetCheck();
  1301. } // end CClientSettingsDlg::OnClickedCsMappingComports
  1302. /*******************************************************************************
  1303. *
  1304. * OnClickedCsMappingClipboard - CClientSettingsDlg member function: command
  1305. *
  1306. * Set the state of fDisableClip flag when 'Disable Client Clipboard
  1307. * Mapping' checkbox is clicked.
  1308. *
  1309. * ENTRY:
  1310. * EXIT:
  1311. *
  1312. ******************************************************************************/
  1313. void
  1314. CClientSettingsDlg::OnClickedCsMappingClipboard()
  1315. {
  1316. m_UserConfig.fDisableClip =
  1317. ((CButton *)GetDlgItem(IDC_CS_MAPPING_CLIPBOARD))->GetCheck();
  1318. } // end CClientSettingsDlg::OnClickedCsMappingClipboard
  1319. /*******************************************************************************
  1320. *
  1321. * OnClickedCsMappingAudio - CClientSettingsDlg member function: command
  1322. *
  1323. * Set the state of fDisableCam flag when 'Disable Client Audio
  1324. * Mapping' checkbox is clicked.
  1325. *
  1326. * ENTRY:
  1327. * EXIT:
  1328. *
  1329. ******************************************************************************/
  1330. void
  1331. CClientSettingsDlg::OnClickedCsMappingAudio()
  1332. {
  1333. m_UserConfig.fDisableCam =
  1334. ((CButton *)GetDlgItem(IDC_CS_MAPPING_AUDIO))->GetCheck();
  1335. } // end CClientSettingsDlg::OnClickedCsMappingAudio
  1336. /*******************************************************************************
  1337. *
  1338. * OnOK - CClientSettingsDlg member function: command (override)
  1339. *
  1340. * Read all control contents back into the dialog's member variables
  1341. * before closing the dialog.
  1342. *
  1343. * ENTRY:
  1344. * EXIT:
  1345. * (Refer to CDialog::OnOk documentation)
  1346. *
  1347. ******************************************************************************/
  1348. void
  1349. CClientSettingsDlg::OnOK()
  1350. {
  1351. /*
  1352. * Call the parent classes' OnOk to complete dialog closing
  1353. * and destruction.
  1354. */
  1355. CBaseDialog::OnOK();
  1356. } // end CClientSettingsDlg::OnOk
  1357. /*******************************************************************************
  1358. *
  1359. * OnCancel - CClientSettingsDlg member function: command (override)
  1360. *
  1361. * Cancel dialog.
  1362. *
  1363. * ENTRY:
  1364. * EXIT:
  1365. * (Refer to CDialog::OnCancel documentation)
  1366. *
  1367. ******************************************************************************/
  1368. void
  1369. CClientSettingsDlg::OnCancel()
  1370. {
  1371. /*
  1372. * Call the parent classes' OnCancel to complete dialog closing
  1373. * and destruction.
  1374. */
  1375. CBaseDialog::OnCancel();
  1376. } // end CClientSettingsDlg::OnCancel
  1377. ////////////////////////////////////////////////////////////////////////////////
  1378. ////////////////////////////////////////////////////////////////////////////////
  1379. // CAdvancedAsyncDlg class construction / destruction, implementation
  1380. /*******************************************************************************
  1381. *
  1382. * CAdvancedAsyncDlg - CAdvancedAsyncDlg constructor
  1383. *
  1384. * ENTRY:
  1385. * EXIT:
  1386. * (Refer to MFC CDialog::CDialog documentation)
  1387. *
  1388. ******************************************************************************/
  1389. CAdvancedAsyncDlg::CAdvancedAsyncDlg()
  1390. : CBaseDialog(CAdvancedAsyncDlg::IDD)
  1391. {
  1392. //{{AFX_DATA_INIT(CAdvancedAsyncDlg)
  1393. // NOTE: the ClassWizard will add member initialization here
  1394. //}}AFX_DATA_INIT
  1395. } // end CAdvancedAsyncDlg::CAdvancedAsyncDlg
  1396. ////////////////////////////////////////////////////////////////////////////////
  1397. // CAdvancedAsyncDlg operations
  1398. /*******************************************************************************
  1399. *
  1400. * HandleEnterEscKey - CAdvancedAsyncDlg member function: private operation
  1401. *
  1402. * If the ENTER or ESC key is pressed while a combo box is dropped down,
  1403. * treat as combo box selection (suppress OnOk/OnCancel notification).
  1404. *
  1405. * ENTRY:
  1406. * nID (input)
  1407. * IDOK if OK button (ENTER) brought us here; otherwise, IDCANCEL for
  1408. * Cancel button (ESC).
  1409. * EXIT:
  1410. * TRUE to process Enter/Esc (perform OnOk/OnCancel); FALSE to ignore
  1411. * (a combo box is dropped down).
  1412. *
  1413. ******************************************************************************/
  1414. BOOL
  1415. CAdvancedAsyncDlg::HandleEnterEscKey(int nID)
  1416. {
  1417. /*
  1418. * Check HW Flow Receive and Transmit combo boxes.
  1419. */
  1420. if ( ((CComboBox *)GetDlgItem(IDC_ASYNC_ADVANCED_HWRX))->GetDroppedState() ) {
  1421. if ( nID == IDCANCEL ) { // select original selection
  1422. ((CComboBox *)GetDlgItem(IDC_ASYNC_ADVANCED_HWRX))->
  1423. SetCurSel(m_Async.FlowControl.HardwareReceive);
  1424. }
  1425. ((CComboBox *)GetDlgItem(IDC_ASYNC_ADVANCED_HWRX))->ShowDropDown(FALSE);
  1426. return(FALSE);
  1427. }
  1428. if ( ((CComboBox *)GetDlgItem(IDC_ASYNC_ADVANCED_HWTX))->GetDroppedState() ) {
  1429. if ( nID == IDCANCEL ) { // select original selection
  1430. ((CComboBox *)GetDlgItem(IDC_ASYNC_ADVANCED_HWTX))->
  1431. SetCurSel(m_Async.FlowControl.HardwareTransmit);
  1432. }
  1433. ((CComboBox *)GetDlgItem(IDC_ASYNC_ADVANCED_HWTX))->ShowDropDown(FALSE);
  1434. return(FALSE);
  1435. }
  1436. /*
  1437. * No combo boxes are down; process Enter/Esc.
  1438. */
  1439. return(TRUE);
  1440. } // end CAdvancedAsyncDlg::HandleEnterEscKey
  1441. /*******************************************************************************
  1442. *
  1443. * SetFields - CAdvancedAsyncDlg member function: private operation
  1444. *
  1445. * Set the dialog fields.
  1446. *
  1447. * ENTRY:
  1448. * EXIT:
  1449. *
  1450. ******************************************************************************/
  1451. void
  1452. CAdvancedAsyncDlg::SetFields()
  1453. {
  1454. int nId;
  1455. /*
  1456. * Set the FLOWCONTROL radio buttons.
  1457. */
  1458. switch( m_Async.FlowControl.Type ) {
  1459. case FlowControl_None:
  1460. nId = IDC_ASYNC_ADVANCED_FLOWCONTROL_NONE;
  1461. break;
  1462. case FlowControl_Hardware:
  1463. nId = IDC_ASYNC_ADVANCED_FLOWCONTROL_HARDWARE;
  1464. break;
  1465. case FlowControl_Software:
  1466. nId = IDC_ASYNC_ADVANCED_FLOWCONTROL_SOFTWARE;
  1467. break;
  1468. }
  1469. CheckRadioButton( IDC_ASYNC_ADVANCED_FLOWCONTROL_HARDWARE,
  1470. IDC_ASYNC_ADVANCED_FLOWCONTROL_NONE,
  1471. nId );
  1472. /*
  1473. * Set the text of the Hardware flowcontrol button.
  1474. */
  1475. SetHWFlowText();
  1476. /*
  1477. * If a modem is defined, disable the Flow Control fields, since they cannot
  1478. * be modified (must match modem's flow control established in Modem dialog).
  1479. */
  1480. if ( m_bModem ) {
  1481. for ( nId = IDL_ASYNC_ADVANCED_FLOWCONTROL;
  1482. nId <= IDC_ASYNC_ADVANCED_FLOWCONTROL_NONE; nId++ )
  1483. GetDlgItem(nId)->EnableWindow(FALSE);
  1484. }
  1485. /*
  1486. * Call member functions to set the Global, Hardware, and Software fields.
  1487. */
  1488. SetGlobalFields();
  1489. SetHWFields();
  1490. SetSWFields();
  1491. } // end CAdvancedAsyncDlg::SetFields
  1492. /*******************************************************************************
  1493. *
  1494. * SetHWFlowText - CAdvancedAsyncDlg member function: private operation
  1495. *
  1496. * Set the contents of the flow control configuration field.
  1497. *
  1498. * ENTRY:
  1499. * EXIT:
  1500. *
  1501. ******************************************************************************/
  1502. void
  1503. CAdvancedAsyncDlg::SetHWFlowText()
  1504. {
  1505. CString str( TEXT("Hardware (") );
  1506. switch ( m_Async.FlowControl.HardwareReceive ) {
  1507. case ReceiveFlowControl_None:
  1508. str += TEXT(".../");
  1509. break;
  1510. case ReceiveFlowControl_RTS:
  1511. str += TEXT("RTS/");
  1512. break;
  1513. case ReceiveFlowControl_DTR:
  1514. str += TEXT("DTR/");
  1515. break;
  1516. }
  1517. switch ( m_Async.FlowControl.HardwareTransmit ) {
  1518. case TransmitFlowControl_None:
  1519. str += TEXT("...)");
  1520. break;
  1521. case TransmitFlowControl_CTS:
  1522. str += TEXT("CTS)");
  1523. break;
  1524. case TransmitFlowControl_DSR:
  1525. str += TEXT("DSR)");
  1526. break;
  1527. }
  1528. SetDlgItemText( IDC_ASYNC_ADVANCED_FLOWCONTROL_HARDWARE, str );
  1529. } // end CAdvancedAsyncDlg::SetHWFlowText
  1530. /*******************************************************************************
  1531. *
  1532. * SetGlobalFields - CAdvancedAsyncDlg member function: private operation
  1533. *
  1534. * Set the 'global' dialog fields common to both HW and SW flowcontrol.
  1535. *
  1536. * ENTRY:
  1537. * EXIT:
  1538. *
  1539. ******************************************************************************/
  1540. void
  1541. CAdvancedAsyncDlg::SetGlobalFields()
  1542. {
  1543. /*
  1544. * Select proper DTR radio button.
  1545. */
  1546. CheckRadioButton( IDC_ASYNC_ADVANCED_DTROFF, IDC_ASYNC_ADVANCED_DTRON,
  1547. IDC_ASYNC_ADVANCED_DTROFF +
  1548. (int)m_Async.FlowControl.fEnableDTR );
  1549. /*
  1550. * Select proper RTS radio button.
  1551. */
  1552. CheckRadioButton( IDC_ASYNC_ADVANCED_RTSOFF, IDC_ASYNC_ADVANCED_RTSON,
  1553. IDC_ASYNC_ADVANCED_RTSOFF +
  1554. (int)m_Async.FlowControl.fEnableRTS );
  1555. /*
  1556. * Set the PARITY radio buttons.
  1557. */
  1558. CheckRadioButton( IDC_ASYNC_ADVANCED_PARITY_NONE,
  1559. IDC_ASYNC_ADVANCED_PARITY_SPACE,
  1560. IDC_ASYNC_ADVANCED_PARITY_NONE +
  1561. (int)m_Async.Parity );
  1562. /*
  1563. * Set the STOPBITS radio buttons.
  1564. */
  1565. CheckRadioButton( IDC_ASYNC_ADVANCED_STOPBITS_1,
  1566. IDC_ASYNC_ADVANCED_STOPBITS_2,
  1567. IDC_ASYNC_ADVANCED_STOPBITS_1 +
  1568. (int)m_Async.StopBits );
  1569. /*
  1570. * Set the BYTESIZE radio buttons.
  1571. *
  1572. * NOTE: the constant '7' that is subtracted from the stored ByteSize
  1573. * must track the lowest allowed byte size / BYTESIZE radio button.
  1574. */
  1575. CheckRadioButton( IDC_ASYNC_ADVANCED_BYTESIZE_7,
  1576. IDC_ASYNC_ADVANCED_BYTESIZE_8,
  1577. IDC_ASYNC_ADVANCED_BYTESIZE_7 +
  1578. ((int)m_Async.ByteSize - 7) );
  1579. /*
  1580. * If the currently selected Wd is an ICA type, disable the BYTESIZE
  1581. * group box and buttons - user can't change from default.
  1582. */
  1583. if ( m_nWdFlag & WDF_ICA ) {
  1584. int i;
  1585. for ( i = IDL_ASYNC_ADVANCED_BYTESIZE;
  1586. i <= IDC_ASYNC_ADVANCED_BYTESIZE_8; i++ )
  1587. GetDlgItem(i)->EnableWindow(FALSE);
  1588. }
  1589. } // end CAdvancedAsyncDlg::SetGlobalFields
  1590. /*******************************************************************************
  1591. *
  1592. * SetHWFields - CAdvancedAsyncDlg member function: private operation
  1593. *
  1594. * Set the dialog fields specific to HW flowcontrol.
  1595. *
  1596. * ENTRY:
  1597. * EXIT:
  1598. *
  1599. ******************************************************************************/
  1600. void
  1601. CAdvancedAsyncDlg::SetHWFields()
  1602. {
  1603. int i;
  1604. /*
  1605. * Initialize HW Receive class combo-box
  1606. */
  1607. ((CComboBox *)GetDlgItem(IDC_ASYNC_ADVANCED_HWRX))->
  1608. SetCurSel(m_Async.FlowControl.HardwareReceive);
  1609. /*
  1610. * If HW flow control is selected AND the HW Receive class is set to
  1611. * ReceiveFlowControl_DTR, disable the DTR controls & labels.
  1612. * Otherwise, enable the DTR control & labels.
  1613. */
  1614. for ( i=IDL_ASYNC_ADVANCED_DTRSTATE;
  1615. i <=IDC_ASYNC_ADVANCED_DTRON; i++ )
  1616. GetDlgItem(i)->EnableWindow(
  1617. ((m_Async.FlowControl.Type == FlowControl_Hardware) &&
  1618. (m_Async.FlowControl.HardwareReceive == ReceiveFlowControl_DTR)) ?
  1619. FALSE : TRUE );
  1620. /*
  1621. * Initialize HW Transmit class combo-box.
  1622. */
  1623. ((CComboBox *)GetDlgItem(IDC_ASYNC_ADVANCED_HWTX))->
  1624. SetCurSel(m_Async.FlowControl.HardwareTransmit);
  1625. /*
  1626. * If HW flow control is selected AND the HW Receive class is set to
  1627. * ReceiveFlowControl_RTS, disable the RTS controls & labels.
  1628. * Otherwise, enable the RTS control & labels.
  1629. */
  1630. for ( i=IDL_ASYNC_ADVANCED_RTSSTATE;
  1631. i <=IDC_ASYNC_ADVANCED_RTSON; i++ )
  1632. GetDlgItem(i)->EnableWindow(
  1633. ((m_Async.FlowControl.Type == FlowControl_Hardware) &&
  1634. (m_Async.FlowControl.HardwareReceive == ReceiveFlowControl_RTS)) ?
  1635. FALSE : TRUE );
  1636. /*
  1637. * Enable or disable all HW fields.
  1638. */
  1639. for ( i=IDL_ASYNC_ADVANCED_HARDWARE;
  1640. i <=IDC_ASYNC_ADVANCED_HWTX; i++ )
  1641. GetDlgItem(i)->EnableWindow(m_Async.FlowControl.Type == FlowControl_Hardware);
  1642. } // end CAdvancedAsyncDlg::SetHWFields
  1643. /*******************************************************************************
  1644. *
  1645. * SetSWFields - CAdvancedAsyncDlg member function: private operation
  1646. *
  1647. * Set the dialog fields specific to SW flowcontrol.
  1648. *
  1649. * ENTRY:
  1650. * EXIT:
  1651. *
  1652. ******************************************************************************/
  1653. void
  1654. CAdvancedAsyncDlg::SetSWFields()
  1655. {
  1656. TCHAR string[UCHAR_DIGIT_MAX];
  1657. int i;
  1658. /*
  1659. * Initialize Xon character edit control.
  1660. */
  1661. wsprintf( string, (m_nHexBase ? TEXT("0x%02X") : TEXT("%d")),
  1662. (UCHAR)m_Async.FlowControl.XonChar );
  1663. SetDlgItemText( IDC_ASYNC_ADVANCED_XON, string );
  1664. ((CEdit *)GetDlgItem(IDC_ASYNC_ADVANCED_XON))
  1665. ->SetModify(FALSE);
  1666. ((CEdit *)GetDlgItem(IDC_ASYNC_ADVANCED_XON))
  1667. ->LimitText( UCHAR_DIGIT_MAX-1 );
  1668. /*
  1669. * Initialize Xoff character edit control.
  1670. */
  1671. wsprintf( string, (m_nHexBase ? TEXT("0x%02X") : TEXT("%d")),
  1672. (UCHAR)m_Async.FlowControl.XoffChar );
  1673. SetDlgItemText( IDC_ASYNC_ADVANCED_XOFF, string );
  1674. ((CEdit *)GetDlgItem(IDC_ASYNC_ADVANCED_XOFF))
  1675. ->SetModify(FALSE);
  1676. ((CEdit *)GetDlgItem(IDC_ASYNC_ADVANCED_XOFF))
  1677. ->LimitText( UCHAR_DIGIT_MAX-1 );
  1678. /*
  1679. * Initialize the Xon/Xoff base control.
  1680. */
  1681. CheckRadioButton( IDC_ASYNC_ADVANCED_BASEDEC, IDC_ASYNC_ADVANCED_BASEHEX,
  1682. IDC_ASYNC_ADVANCED_BASEDEC + m_nHexBase );
  1683. /*
  1684. * Enable or disable all SW fields.
  1685. */
  1686. for ( i=IDL_ASYNC_ADVANCED_SOFTWARE;
  1687. i <=IDC_ASYNC_ADVANCED_BASEHEX; i++ )
  1688. GetDlgItem(i)->EnableWindow(m_Async.FlowControl.Type == FlowControl_Software);
  1689. } // end CAdvancedAsyncDlg::SetSWFields
  1690. /*******************************************************************************
  1691. *
  1692. * GetFields - CAdvancedAsyncDlg member function: private operation
  1693. *
  1694. * Fetch and validate the dialog fields.
  1695. *
  1696. * ENTRY:
  1697. * EXIT:
  1698. * (BOOL)
  1699. * Returns TRUE if all fields were valid; FALSE otherwise. If FALSE,
  1700. * will have output an error message and set the focus back to the
  1701. * field in error for the user to correct.
  1702. *
  1703. ******************************************************************************/
  1704. BOOL
  1705. CAdvancedAsyncDlg::GetFields()
  1706. {
  1707. /*
  1708. * Call member functions to get the Flow Control, Global, Hardware, and
  1709. * Software fields.
  1710. */
  1711. GetFlowControlFields();
  1712. if ( !GetGlobalFields() )
  1713. return(FALSE);
  1714. if ( !GetHWFields() )
  1715. return(FALSE);
  1716. if ( !GetSWFields(TRUE) )
  1717. return(FALSE);
  1718. return(TRUE);
  1719. } // end CAdvancedAsyncDlg::GetFields
  1720. /*******************************************************************************
  1721. *
  1722. * GetFlowControlFields - CAdvancedAsyncDlg member function: private operation
  1723. *
  1724. * Fetch the flow control configuration field contents.
  1725. *
  1726. * ENTRY:
  1727. * EXIT:
  1728. *
  1729. ******************************************************************************/
  1730. void
  1731. CAdvancedAsyncDlg::GetFlowControlFields()
  1732. {
  1733. switch ( GetCheckedRadioButton( IDC_ASYNC_ADVANCED_FLOWCONTROL_HARDWARE,
  1734. IDC_ASYNC_ADVANCED_FLOWCONTROL_NONE ) ) {
  1735. case IDC_ASYNC_ADVANCED_FLOWCONTROL_NONE:
  1736. m_Async.FlowControl.Type = FlowControl_None;
  1737. break;
  1738. case IDC_ASYNC_ADVANCED_FLOWCONTROL_SOFTWARE:
  1739. m_Async.FlowControl.Type = FlowControl_Software;
  1740. break;
  1741. case IDC_ASYNC_ADVANCED_FLOWCONTROL_HARDWARE:
  1742. m_Async.FlowControl.Type = FlowControl_Hardware;
  1743. break;
  1744. }
  1745. } // end CAdvancedAsyncDlg::GetFlowControlFields
  1746. /*******************************************************************************
  1747. *
  1748. * GetGlobalFields - CAdvancedAsyncDlg member function: private operation
  1749. *
  1750. * Fetch and validate the 'global' dialog fields common to both HW and
  1751. * SW flowcontrol.
  1752. *
  1753. * ENTRY:
  1754. *
  1755. * EXIT:
  1756. * (BOOL)
  1757. * Returns TRUE if all fields were valid; FALSE otherwise. If FALSE,
  1758. * will have output an error message and set the focus back to the
  1759. * field in error for the user to correct.
  1760. *
  1761. ******************************************************************************/
  1762. BOOL
  1763. CAdvancedAsyncDlg::GetGlobalFields()
  1764. {
  1765. /*
  1766. * Fetch DTR state.
  1767. */
  1768. m_Async.FlowControl.fEnableDTR =
  1769. (GetCheckedRadioButton( IDC_ASYNC_ADVANCED_DTROFF,
  1770. IDC_ASYNC_ADVANCED_DTRON )
  1771. - IDC_ASYNC_ADVANCED_DTROFF);
  1772. /*
  1773. * Fetch RTS state.
  1774. */
  1775. m_Async.FlowControl.fEnableRTS =
  1776. (GetCheckedRadioButton( IDC_ASYNC_ADVANCED_RTSOFF,
  1777. IDC_ASYNC_ADVANCED_RTSON )
  1778. - IDC_ASYNC_ADVANCED_RTSOFF);
  1779. /*
  1780. * Fetch the selected PARITY.
  1781. */
  1782. m_Async.Parity = (ULONG)
  1783. (GetCheckedRadioButton( IDC_ASYNC_ADVANCED_PARITY_NONE,
  1784. IDC_ASYNC_ADVANCED_PARITY_SPACE )
  1785. - IDC_ASYNC_ADVANCED_PARITY_NONE);
  1786. /*
  1787. * Fetch the selected STOPBITS.
  1788. */
  1789. m_Async.StopBits = (ULONG)
  1790. (GetCheckedRadioButton( IDC_ASYNC_ADVANCED_STOPBITS_1,
  1791. IDC_ASYNC_ADVANCED_STOPBITS_2 )
  1792. - IDC_ASYNC_ADVANCED_STOPBITS_1);
  1793. /*
  1794. * Fetch the selected BYTESIZE.
  1795. *
  1796. * NOTE: the constant '7' that is added to the stored ByteSize
  1797. * must track the lowest allowed byte size / BYTESIZE radio button.
  1798. */
  1799. m_Async.ByteSize = (ULONG)
  1800. (GetCheckedRadioButton( IDC_ASYNC_ADVANCED_BYTESIZE_7,
  1801. IDC_ASYNC_ADVANCED_BYTESIZE_8 )
  1802. - IDC_ASYNC_ADVANCED_BYTESIZE_7 + 7);
  1803. return(TRUE);
  1804. } // end CAdvancedAsyncDlg::GetGlobalFields
  1805. /*******************************************************************************
  1806. *
  1807. * GetHWFields - CAdvancedAsyncDlg member function: private operation
  1808. *
  1809. * Fetch and validate the dialog fields specific to HW flowcontrol.
  1810. *
  1811. * ENTRY:
  1812. *
  1813. * EXIT:
  1814. * (BOOL)
  1815. * Returns TRUE if all fields were valid; FALSE otherwise. If FALSE,
  1816. * will have output an error message and set the focus back to the
  1817. * field in error for the user to correct.
  1818. *
  1819. ******************************************************************************/
  1820. BOOL
  1821. CAdvancedAsyncDlg::GetHWFields()
  1822. {
  1823. /*
  1824. * Fetch the HW receive flow class.
  1825. */
  1826. m_Async.FlowControl.HardwareReceive = (RECEIVEFLOWCONTROLCLASS)
  1827. ((CComboBox *)GetDlgItem(IDC_ASYNC_ADVANCED_HWRX))->GetCurSel();
  1828. /*
  1829. * Fetch the HW transmit flow class.
  1830. */
  1831. m_Async.FlowControl.HardwareTransmit = (TRANSMITFLOWCONTROLCLASS)
  1832. ((CComboBox *)GetDlgItem(IDC_ASYNC_ADVANCED_HWTX))->GetCurSel();
  1833. return(TRUE);
  1834. } // end CAdvancedAsyncDlg::GetHWFields
  1835. /*******************************************************************************
  1836. *
  1837. * GetSWFields - CAdvancedAsyncDlg member function: private operation
  1838. *
  1839. * Fetch and optionally validate the dialog fields specific to SW
  1840. * flowcontrol.
  1841. *
  1842. * ENTRY:
  1843. * bValidate (input)
  1844. * TRUE if validation is desired; FALSE if no validation desired.
  1845. * EXIT:
  1846. * (BOOL)
  1847. * Returns TRUE if all fields were valid or if no validation was
  1848. * desired; FALSE otherwise. If FALSE, will have output an error
  1849. * message and set the focus back to the field in error for the
  1850. * user to correct.
  1851. *
  1852. ******************************************************************************/
  1853. BOOL
  1854. CAdvancedAsyncDlg::GetSWFields( BOOL bValidate )
  1855. {
  1856. TCHAR string[UCHAR_DIGIT_MAX], *endptr;
  1857. ULONG ul;
  1858. int nNewHexBase, base;
  1859. /*
  1860. * Determine the current state of the base controls and save.
  1861. */
  1862. nNewHexBase = (GetCheckedRadioButton( IDC_ASYNC_ADVANCED_BASEDEC,
  1863. IDC_ASYNC_ADVANCED_BASEHEX )
  1864. - IDC_ASYNC_ADVANCED_BASEDEC);
  1865. /*
  1866. * Fetch and convert XON character.
  1867. */
  1868. GetDlgItemText(IDC_ASYNC_ADVANCED_XON, string, lengthof(string));
  1869. /*
  1870. * If the edit box is modified, use the 'new' base for conversion.
  1871. */
  1872. base = ((CEdit *)GetDlgItem(IDC_ASYNC_ADVANCED_XON))->GetModify() ?
  1873. nNewHexBase : m_nHexBase;
  1874. ul = lstrtoul( string, &endptr, (base ? 16 : 10) );
  1875. /*
  1876. * If validation is requested and there is a problem with the input,
  1877. * complain and allow user to fix.
  1878. */
  1879. if ( bValidate && ((*endptr != TEXT('\0')) || (ul < 0) || (ul > 255)) ) {
  1880. /*
  1881. * Invalid character in field or invalid value.
  1882. */
  1883. ERROR_MESSAGE((IDP_INVALID_XONXOFF))
  1884. /*
  1885. * Set focus to the control so that it can be fixed.
  1886. */
  1887. GotoDlgCtrl(GetDlgItem(IDC_ASYNC_ADVANCED_XON));
  1888. return(FALSE);
  1889. }
  1890. /*
  1891. * Save the Xon character.
  1892. */
  1893. m_Async.FlowControl.XonChar = (UCHAR)ul;
  1894. /*
  1895. * Fetch and convert XOFF character.
  1896. */
  1897. GetDlgItemText(IDC_ASYNC_ADVANCED_XOFF, string, lengthof(string));
  1898. /*
  1899. * If the edit box is modified, use the 'new' base for conversion.
  1900. */
  1901. base = ((CEdit *)GetDlgItem(IDC_ASYNC_ADVANCED_XOFF))->GetModify() ?
  1902. nNewHexBase : m_nHexBase;
  1903. ul = lstrtoul( string, &endptr, (base ? 16 : 10) );
  1904. /*
  1905. * If validation is requested and there is a problem with the input,
  1906. * complain and allow user to fix.
  1907. */
  1908. if ( bValidate && ((*endptr != TEXT('\0')) || (ul < 0) || (ul > 255)) ) {
  1909. /*
  1910. * Invalid character in field or invalid value.
  1911. */
  1912. ERROR_MESSAGE((IDP_INVALID_XONXOFF))
  1913. /*
  1914. * Set focus to the control so that it can be fixed.
  1915. */
  1916. GotoDlgCtrl(GetDlgItem(IDC_ASYNC_ADVANCED_XOFF));
  1917. return(FALSE);
  1918. }
  1919. /*
  1920. * Save the Xoff character.
  1921. */
  1922. m_Async.FlowControl.XoffChar = (UCHAR)ul;
  1923. /*
  1924. * Save the current base state.
  1925. */
  1926. m_nHexBase = nNewHexBase;
  1927. return(TRUE);
  1928. } // end CAdvancedAsyncDlg::GetSWFields
  1929. ////////////////////////////////////////////////////////////////////////////////
  1930. // CAdvancedAsyncDlg message map
  1931. BEGIN_MESSAGE_MAP(CAdvancedAsyncDlg, CBaseDialog)
  1932. //{{AFX_MSG_MAP(CAdvancedAsyncDlg)
  1933. ON_BN_CLICKED(IDC_ASYNC_ADVANCED_BASEDEC, OnClickedAsyncAdvancedBasedec)
  1934. ON_BN_CLICKED(IDC_ASYNC_ADVANCED_BASEHEX, OnClickedAsyncAdvancedBasehex)
  1935. ON_CBN_CLOSEUP(IDC_ASYNC_ADVANCED_HWRX, OnCloseupAsyncAdvancedHwrx)
  1936. ON_CBN_SELCHANGE(IDC_ASYNC_ADVANCED_HWRX, OnSelchangeAsyncAdvancedHwrx)
  1937. ON_CBN_CLOSEUP(IDC_ASYNC_ADVANCED_HWTX, OnCloseupAsyncAdvancedHwtx)
  1938. ON_CBN_SELCHANGE(IDC_ASYNC_ADVANCED_HWTX, OnSelchangeAsyncAdvancedHwtx)
  1939. ON_BN_CLICKED(IDC_ASYNC_ADVANCED_FLOWCONTROL_HARDWARE, OnClickedAsyncAdvancedFlowcontrolHardware)
  1940. ON_BN_CLICKED(IDC_ASYNC_ADVANCED_FLOWCONTROL_SOFTWARE, OnClickedAsyncAdvancedFlowcontrolSoftware)
  1941. ON_BN_CLICKED(IDC_ASYNC_ADVANCED_FLOWCONTROL_NONE, OnClickedAsyncAdvancedFlowcontrolNone)
  1942. //}}AFX_MSG_MAP
  1943. END_MESSAGE_MAP()
  1944. ////////////////////////////////////////////////////////////////////////////////
  1945. // CAdvancedAsyncDlg commands
  1946. /*******************************************************************************
  1947. *
  1948. * OnInitDialog - CAdvancedAsyncDlg member function: command (override)
  1949. *
  1950. * Performs the dialog intialization.
  1951. *
  1952. * ENTRY:
  1953. * EXIT:
  1954. * (Refer to CDialog::OnInitDialog documentation)
  1955. *
  1956. ******************************************************************************/
  1957. BOOL
  1958. CAdvancedAsyncDlg::OnInitDialog()
  1959. {
  1960. int i;
  1961. CString string;
  1962. CComboBox *pComboBox;
  1963. /*
  1964. * Call the parent classes' OnInitDialog to perform default dialog
  1965. * initialization.
  1966. */
  1967. CBaseDialog::OnInitDialog();
  1968. /*
  1969. * Load up combo boxes with strings.
  1970. */
  1971. pComboBox = (CComboBox *)GetDlgItem(IDC_ASYNC_ADVANCED_HWRX);
  1972. string.LoadString(IDS_ASYNC_ADVANCED_HWRX_NOTHING);
  1973. pComboBox->AddString(string);
  1974. string.LoadString(IDS_ASYNC_ADVANCED_HWRX_TURN_OFF_RTS);
  1975. pComboBox->AddString(string);
  1976. string.LoadString(IDS_ASYNC_ADVANCED_HWRX_TURN_OFF_DTR);
  1977. pComboBox->AddString(string);
  1978. pComboBox = (CComboBox *)GetDlgItem(IDC_ASYNC_ADVANCED_HWTX);
  1979. string.LoadString(IDS_ASYNC_ADVANCED_HWTX_ALWAYS);
  1980. pComboBox->AddString(string);
  1981. string.LoadString(IDS_ASYNC_ADVANCED_HWTX_WHEN_CTS_IS_ON);
  1982. pComboBox->AddString(string);
  1983. string.LoadString(IDS_ASYNC_ADVANCED_HWTX_WHEN_DSR_IS_ON);
  1984. pComboBox->AddString(string);
  1985. /*
  1986. * Initalize all dialog fields.
  1987. */
  1988. SetFields();
  1989. if ( m_bReadOnly ) {
  1990. /*
  1991. * Document is 'read-only': disable all dialog controls and labels
  1992. * except for CANCEL & HELP buttons.
  1993. */
  1994. for ( i=IDL_ASYNC_ADVANCED_FLOWCONTROL;
  1995. i <=IDC_ASYNC_ADVANCED_BYTESIZE_8; i++ )
  1996. GetDlgItem(i)->EnableWindow(FALSE);
  1997. GetDlgItem(IDOK)->EnableWindow(FALSE);
  1998. }
  1999. /*
  2000. * Set all combo boxes to use the 'extended' UI.
  2001. */
  2002. ((CComboBox *)GetDlgItem(IDC_ASYNC_ADVANCED_HWRX))->SetExtendedUI(TRUE);
  2003. ((CComboBox *)GetDlgItem(IDC_ASYNC_ADVANCED_HWTX))->SetExtendedUI(TRUE);
  2004. return(TRUE);
  2005. } // end CAdvancedAsyncDlg::OnInitDialog
  2006. /*******************************************************************************
  2007. *
  2008. * OnClickedAsyncAdvancedFlowcontrolHardware -
  2009. * CAdvancedAsyncDlg member function: command
  2010. *
  2011. * Change the state of the FlowControl flags and corresponding dialog
  2012. * controls when HARDWARE is clicked.
  2013. *
  2014. * ENTRY:
  2015. * EXIT:
  2016. *
  2017. ******************************************************************************/
  2018. void
  2019. CAdvancedAsyncDlg::OnClickedAsyncAdvancedFlowcontrolHardware()
  2020. {
  2021. GetFlowControlFields();
  2022. SetFields();
  2023. } // end CAdvancedAsyncDlg::OnClickedAsyncAdvancedFlowcontrolHardware
  2024. /*******************************************************************************
  2025. *
  2026. * OnClickedAsyncAdvancedFlowcontrolSoftware -
  2027. * CAdvancedAsyncDlg member function: command
  2028. *
  2029. * Change the state of the FlowControl flags and corresponding dialog
  2030. * controls when SOFTWARE is clicked.
  2031. *
  2032. * ENTRY:
  2033. * EXIT:
  2034. *
  2035. ******************************************************************************/
  2036. void
  2037. CAdvancedAsyncDlg::OnClickedAsyncAdvancedFlowcontrolSoftware()
  2038. {
  2039. GetFlowControlFields();
  2040. SetFields();
  2041. } // end CAdvancedAsyncDlg::OnClickedAsyncAdvancedFlowcontrolSoftware
  2042. /*******************************************************************************
  2043. *
  2044. * OnClickedAsyncAdvancedFlowcontrolNone -
  2045. * CAdvancedAsyncDlg member function: command
  2046. *
  2047. * Change the state of the FlowControl flags and corresponding dialog
  2048. * controls when NONE is clicked.
  2049. *
  2050. * ENTRY:
  2051. * EXIT:
  2052. *
  2053. ******************************************************************************/
  2054. void
  2055. CAdvancedAsyncDlg::OnClickedAsyncAdvancedFlowcontrolNone()
  2056. {
  2057. GetFlowControlFields();
  2058. SetFields();
  2059. } // end CAdvancedAsyncDlg::OnClickedAsyncAdvancedFlowcontrolNone
  2060. /*******************************************************************************
  2061. *
  2062. * OnCloseupAsyncAdvancedHwrx - CAdvancedAsyncDlg member function: command
  2063. *
  2064. * Invoke OnSelchangeAsyncAdvancedHwrx() when 'receive' HW flow combo box
  2065. * closes up.
  2066. *
  2067. * ENTRY:
  2068. * EXIT:
  2069. *
  2070. ******************************************************************************/
  2071. void
  2072. CAdvancedAsyncDlg::OnCloseupAsyncAdvancedHwrx()
  2073. {
  2074. OnSelchangeAsyncAdvancedHwrx();
  2075. } // end CAdvancedAsyncDlg::OnCloseupAsyncAdvancedHwrx
  2076. /*******************************************************************************
  2077. *
  2078. * OnSelchangeAsyncAdvancedHwrx - CAdvancedAsyncDlg member function: command
  2079. *
  2080. * Process new Hardware Receive Flow Control selection.
  2081. *
  2082. * ENTRY:
  2083. * EXIT:
  2084. *
  2085. ******************************************************************************/
  2086. void
  2087. CAdvancedAsyncDlg::OnSelchangeAsyncAdvancedHwrx()
  2088. {
  2089. CComboBox *pHWRx = (CComboBox *)GetDlgItem(IDC_ASYNC_ADVANCED_HWRX);
  2090. /*
  2091. * Ignore this notification if the combo box is in a dropped-down
  2092. * state.
  2093. */
  2094. if ( pHWRx->GetDroppedState() )
  2095. return;
  2096. /*
  2097. * Fetch and Set the Hardware fields to update.
  2098. */
  2099. GetHWFields();
  2100. SetHWFields();
  2101. SetHWFlowText();
  2102. } // end CAdvancedAsyncDlg::OnSelchangeAsyncAdvancedHwrx
  2103. /*******************************************************************************
  2104. *
  2105. * OnCloseupAsyncAdvancedHwtx - CAdvancedAsyncDlg member function: command
  2106. *
  2107. * Invoke OnSelchangeAsyncAdvancedHwtx() when 'transmit' HW flow combo box
  2108. * closes up.
  2109. *
  2110. * ENTRY:
  2111. * EXIT:
  2112. *
  2113. ******************************************************************************/
  2114. void
  2115. CAdvancedAsyncDlg::OnCloseupAsyncAdvancedHwtx()
  2116. {
  2117. OnSelchangeAsyncAdvancedHwtx();
  2118. } // end CAdvancedAsyncDlg::OnCloseupAsyncAdvancedHwtx
  2119. /*******************************************************************************
  2120. *
  2121. * OnSelchangeAsyncAdvancedHwtx - CAdvancedAsyncDlg member function: command
  2122. *
  2123. * Process new Hardware Transmit Flow Control selection.
  2124. *
  2125. * ENTRY:
  2126. * EXIT:
  2127. *
  2128. ******************************************************************************/
  2129. void
  2130. CAdvancedAsyncDlg::OnSelchangeAsyncAdvancedHwtx()
  2131. {
  2132. CComboBox *pHWTx = (CComboBox *)GetDlgItem(IDC_ASYNC_ADVANCED_HWTX);
  2133. /*
  2134. * Ignore this notification if the combo box is in a dropped-down
  2135. * state.
  2136. */
  2137. if ( pHWTx->GetDroppedState() )
  2138. return;
  2139. /*
  2140. * Fetch and Set the Hardware fields to update.
  2141. */
  2142. GetHWFields();
  2143. SetHWFields();
  2144. SetHWFlowText();
  2145. } // end CAdvancedAsyncDlg::OnSelchangeAsyncAdvancedHwtx
  2146. /*******************************************************************************
  2147. *
  2148. * OnClickedAsyncAdvancedBasedec - CAdvancedAsyncDlg member function: command
  2149. *
  2150. * Process request to display numbers using decimal base.
  2151. *
  2152. * ENTRY:
  2153. * EXIT:
  2154. *
  2155. ******************************************************************************/
  2156. void
  2157. CAdvancedAsyncDlg::OnClickedAsyncAdvancedBasedec()
  2158. {
  2159. /*
  2160. * Get/Set the SW fields to display in decimal base.
  2161. */
  2162. GetSWFields(FALSE);
  2163. SetSWFields();
  2164. } // end CAdvancedAsyncDlg::OnClickedAsyncAdvancedBasedec
  2165. /*******************************************************************************
  2166. *
  2167. * OnClickedAsyncAdvancedBasehex - CAdvancedAsyncDlg member function: command
  2168. *
  2169. * Process request to display numbers using hexadecimal base.
  2170. *
  2171. * ENTRY:
  2172. * EXIT:
  2173. *
  2174. ******************************************************************************/
  2175. void
  2176. CAdvancedAsyncDlg::OnClickedAsyncAdvancedBasehex()
  2177. {
  2178. /*
  2179. * Get/Set the SW fields to display in hexadecimal base.
  2180. */
  2181. GetSWFields(FALSE);
  2182. SetSWFields();
  2183. } // end CAdvancedAsyncDlg::OnClickedAsyncAdvancedBasehex
  2184. /*******************************************************************************
  2185. *
  2186. * OnOK - CAdvancedAsyncDlg member function: command (override)
  2187. *
  2188. * Read all control contents back into the Async config structure
  2189. * before closing the dialog.
  2190. *
  2191. * ENTRY:
  2192. * EXIT:
  2193. * (Refer to CDialog::OnOk documentation)
  2194. *
  2195. ******************************************************************************/
  2196. void
  2197. CAdvancedAsyncDlg::OnOK()
  2198. {
  2199. /*
  2200. * If the Enter key was pressed while a combo box was dropped down, ignore
  2201. * it (treat as combo list selection only).
  2202. */
  2203. if ( !HandleEnterEscKey(IDOK) )
  2204. return;
  2205. /*
  2206. * Fetch the field contents. Return (don't close dialog) if a problem
  2207. * was found.
  2208. */
  2209. if ( !GetFields() )
  2210. return;
  2211. /*
  2212. * Call the parent classes' OnOk to complete dialog closing
  2213. * and destruction.
  2214. */
  2215. CBaseDialog::OnOK();
  2216. } // end CAdvancedAsyncDlg::OnOK
  2217. /*******************************************************************************
  2218. *
  2219. * OnCancel - CAdvancedAsyncDlg member function: command (override)
  2220. *
  2221. * Cancel the dialog.
  2222. *
  2223. * ENTRY:
  2224. * EXIT:
  2225. * (Refer to CDialog::OnCancel documentation)
  2226. *
  2227. ******************************************************************************/
  2228. void
  2229. CAdvancedAsyncDlg::OnCancel()
  2230. {
  2231. /*
  2232. * If the Esc key was pressed while a combo box was dropped down, ignore
  2233. * it (treat as combo close-up and cancel only).
  2234. */
  2235. if ( !HandleEnterEscKey(IDCANCEL) )
  2236. return;
  2237. /*
  2238. * Call the parent classes' OnCancel to complete dialog closing
  2239. * and destruction.
  2240. */
  2241. CBaseDialog::OnCancel();
  2242. } // end CAdvancedAsyncDlg::OnCancel
  2243. ////////////////////////////////////////////////////////////////////////////////