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.

928 lines
26 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Copyright (c) 1997-1999 Microsoft Corporation
  4. // All rights reserved.
  5. //
  6. // File Name:
  7. // rgseting.c
  8. //
  9. // Description:
  10. // This file contains the dialog procedure for the regional settings
  11. // page (IDD_REGIONALSETTINGS).
  12. //
  13. //----------------------------------------------------------------------------
  14. #include "pch.h"
  15. #include "resource.h"
  16. //
  17. // Explanation of the var GenSettings.szLanguageLocaleId
  18. //
  19. // This var is to keep track of the locale id for the keyboard layout selected.
  20. // If the user ever leaves the custom dialog and comes back to it, this var
  21. // determines what locale to select for the keyboard layout. I can't just use
  22. // they keyboard layout they selected because many locales have the same
  23. // keyboard layout so I wouldn't know which one to select.
  24. //
  25. // static TCHAR g_szLanguageLocaleId[MAX_LANGUAGE_LEN] = _T("");
  26. INT_PTR CALLBACK RegionalCustomDisplayDlg( IN HWND hwnd,
  27. IN UINT uMsg,
  28. IN WPARAM wParam,
  29. IN LPARAM lParam);
  30. // *************************************************************************
  31. //
  32. // Dialog proc and helper functions for the regional settings Pop-Up
  33. //
  34. // *************************************************************************
  35. //----------------------------------------------------------------------------
  36. //
  37. // Function: OnRegionalCustomButton
  38. //
  39. // Purpose: Pop-up the custom regional settings window
  40. //
  41. // Arguments: IN HWND hwnd - handle to the dialog box
  42. //
  43. // Returns: VOID
  44. //
  45. //----------------------------------------------------------------------------
  46. VOID
  47. OnRegionalCustomButton( IN HWND hwnd ) {
  48. DialogBox( FixedGlobals.hInstance,
  49. MAKEINTRESOURCE( IDD_REGIONALSETTINGS_POPUP ),
  50. hwnd,
  51. RegionalCustomDisplayDlg );
  52. }
  53. //----------------------------------------------------------------------------
  54. //
  55. // Function: FindAndSelectInComboBox
  56. //
  57. // Purpose: Searches a combo box for a particular string and selects. If the
  58. // string is not found than the first item is selected.
  59. //
  60. // Arguments: IN TCHAR *pString - the string to select
  61. // IN HWND hwnd - handle to the dialog box
  62. // IN INT iControlId - the resource Id of the combo box to search in
  63. // IN BOOL bKeyboardLayout - TRUE if this is the keyboard layout
  64. // combo box, FALSE if it is not
  65. //
  66. // Returns: VOID
  67. //
  68. //----------------------------------------------------------------------------
  69. VOID
  70. FindAndSelectInComboBox( IN TCHAR *pString,
  71. IN HWND hwnd,
  72. IN INT iControlId )
  73. {
  74. INT_PTR i;
  75. INT_PTR iComboBoxCount;
  76. LANGUAGELOCALE_NODE *pLocaleEntry;
  77. iComboBoxCount = SendDlgItemMessage( hwnd,
  78. iControlId,
  79. CB_GETCOUNT,
  80. 0,
  81. (LPARAM) pString );
  82. for( i = 0; i < iComboBoxCount; i++ ) {
  83. pLocaleEntry = (LANGUAGELOCALE_NODE *) SendDlgItemMessage( hwnd,
  84. iControlId,
  85. CB_GETITEMDATA,
  86. i,
  87. 0 );
  88. if( lstrcmp( pString, pLocaleEntry->szLanguageLocaleId ) == 0 )
  89. {
  90. SendDlgItemMessage( hwnd,
  91. iControlId,
  92. CB_SETCURSEL,
  93. i,
  94. 0 );
  95. return;
  96. }
  97. }
  98. //
  99. // If we get to this point, then no match was found so just pick the
  100. // first one
  101. //
  102. AssertMsg( FALSE, "No matching string found." );
  103. SendDlgItemMessage( hwnd,
  104. iControlId,
  105. CB_SETCURSEL,
  106. 0,
  107. 0 );
  108. }
  109. //----------------------------------------------------------------------------
  110. //
  111. // Function: SelectDefaultLocale
  112. //
  113. // Purpose: Selects the default locale in a combo box.
  114. //
  115. // Arguments: IN HWND hwnd - handle to the dialog box
  116. // IN INT ControlId - the resource Id of the combo box to select
  117. // the default locale in
  118. //
  119. // Returns: VOID
  120. //
  121. //----------------------------------------------------------------------------
  122. VOID
  123. SelectDefaultLocale( IN HWND hwnd, IN INT ControlId ) {
  124. INT_PTR i;
  125. INT_PTR iComboBoxCount;
  126. LANGUAGELOCALE_NODE *pLocale;
  127. iComboBoxCount = SendDlgItemMessage( hwnd,
  128. ControlId,
  129. CB_GETCOUNT,
  130. 0,
  131. 0 );
  132. for( i = 0; i < iComboBoxCount; i++ ) {
  133. pLocale = (LANGUAGELOCALE_NODE *) SendDlgItemMessage( hwnd,
  134. ControlId,
  135. CB_GETITEMDATA,
  136. i,
  137. 0 );
  138. //
  139. // Check and see if we found it
  140. //
  141. if( lstrcmp( g_szDefaultLocale, pLocale->szLanguageLocaleId ) == 0 ) {
  142. SendDlgItemMessage( hwnd,
  143. ControlId,
  144. CB_SETCURSEL,
  145. i,
  146. 0 );
  147. break;
  148. }
  149. }
  150. //
  151. // If for some reason we couldn't find the default just select the first one
  152. //
  153. if( i >= iComboBoxCount ) {
  154. AssertMsg( FALSE, "The default language locale was not found." );
  155. SendDlgItemMessage( hwnd,
  156. ControlId,
  157. CB_SETCURSEL,
  158. 0,
  159. 0 );
  160. }
  161. }
  162. //----------------------------------------------------------------------------
  163. //
  164. // Function: StoreLanguageLocales
  165. //
  166. // Purpose: Stores the locales the user specified in to their global
  167. // variables.
  168. //
  169. // Arguments: IN HWND hwnd - handle to the dialog box
  170. //
  171. // Returns: VOID
  172. //
  173. //----------------------------------------------------------------------------
  174. VOID
  175. StoreLanguageLocales( IN HWND hwnd ) {
  176. INT_PTR iComboBoxIndex;
  177. LANGUAGELOCALE_NODE *pLocaleEntry;
  178. //
  179. // Grab the language locale id from the Menus combo box and store
  180. // it in the proper global
  181. //
  182. iComboBoxIndex = SendDlgItemMessage( hwnd,
  183. IDC_CB_MENUS,
  184. CB_GETCURSEL,
  185. 0,
  186. 0 );
  187. pLocaleEntry = (LANGUAGELOCALE_NODE *) SendDlgItemMessage( hwnd,
  188. IDC_CB_MENUS,
  189. CB_GETITEMDATA,
  190. iComboBoxIndex,
  191. 0 );
  192. lstrcpyn( GenSettings.szMenuLanguage, pLocaleEntry->szLanguageLocaleId, AS(GenSettings.szMenuLanguage) );
  193. //
  194. // Grab the language locale id from the Units combo box and store
  195. // it in the proper global
  196. //
  197. iComboBoxIndex = SendDlgItemMessage( hwnd,
  198. IDC_CB_UNITS,
  199. CB_GETCURSEL,
  200. 0,
  201. 0 );
  202. pLocaleEntry = (LANGUAGELOCALE_NODE *) SendDlgItemMessage( hwnd,
  203. IDC_CB_UNITS,
  204. CB_GETITEMDATA,
  205. iComboBoxIndex,
  206. 0 );
  207. lstrcpyn( GenSettings.szNumberLanguage, pLocaleEntry->szLanguageLocaleId, AS(GenSettings.szNumberLanguage) );
  208. //
  209. // Grab the language locale id from the Keyboard layout combo box and
  210. // store it in the proper global
  211. //
  212. iComboBoxIndex = SendDlgItemMessage( hwnd,
  213. IDC_CB_KEYBOARD_LAYOUT,
  214. CB_GETCURSEL,
  215. 0,
  216. 0 );
  217. pLocaleEntry = (LANGUAGELOCALE_NODE *) SendDlgItemMessage( hwnd,
  218. IDC_CB_KEYBOARD_LAYOUT,
  219. CB_GETITEMDATA,
  220. iComboBoxIndex,
  221. 0 );
  222. lstrcpyn( GenSettings.szKeyboardLayout, pLocaleEntry->szKeyboardLayout, AS(GenSettings.szKeyboardLayout) );
  223. lstrcpyn( GenSettings.szLanguageLocaleId, pLocaleEntry->szLanguageLocaleId, AS(GenSettings.szLanguageLocaleId) );
  224. }
  225. //----------------------------------------------------------------------------
  226. //
  227. // Function: LoadRegionalSettingsComboBoxes
  228. //
  229. // Purpose: Loads the menu, units and keybaord layout locale combo boxes
  230. // with the locale strings.
  231. //
  232. // Arguments: IN HWND hwnd - handle to the dialog box
  233. //
  234. // Returns: VOID
  235. //
  236. //----------------------------------------------------------------------------
  237. VOID
  238. LoadRegionalSettingsComboBoxes( IN HWND hwnd ) {
  239. INT_PTR iComboBoxIndex;
  240. LANGUAGELOCALE_NODE *CurrentLocale = NULL;
  241. //
  242. // Add the valid locals to the combo boxes
  243. //
  244. for( CurrentLocale = FixedGlobals.LanguageLocaleList;
  245. CurrentLocale != NULL;
  246. CurrentLocale = CurrentLocale->next ) {
  247. //
  248. // Add it to the System combo box
  249. //
  250. iComboBoxIndex = SendDlgItemMessage( hwnd,
  251. IDC_CB_MENUS,
  252. CB_ADDSTRING,
  253. 0,
  254. (LPARAM) CurrentLocale->szLanguageLocaleName );
  255. //
  256. // Associate the Language Locale ID with its entry in the System combo box
  257. //
  258. SendDlgItemMessage( hwnd,
  259. IDC_CB_MENUS,
  260. CB_SETITEMDATA,
  261. iComboBoxIndex,
  262. (LPARAM) CurrentLocale );
  263. //
  264. // Add it to the User combo box
  265. //
  266. iComboBoxIndex = SendDlgItemMessage( hwnd,
  267. IDC_CB_UNITS,
  268. CB_ADDSTRING,
  269. 0,
  270. (LPARAM) CurrentLocale->szLanguageLocaleName );
  271. //
  272. // Associate the Language Locale ID with its entry in the User combo box
  273. //
  274. SendDlgItemMessage( hwnd,
  275. IDC_CB_UNITS,
  276. CB_SETITEMDATA,
  277. iComboBoxIndex,
  278. (LPARAM) CurrentLocale );
  279. //
  280. // Add it to the Keyboard combo box
  281. //
  282. iComboBoxIndex = SendDlgItemMessage( hwnd,
  283. IDC_CB_KEYBOARD_LAYOUT,
  284. CB_ADDSTRING,
  285. 0,
  286. (LPARAM) CurrentLocale->szLanguageLocaleName );
  287. //
  288. // Associate the Language Locale ID with its entry in the Keyboard combo box
  289. //
  290. SendDlgItemMessage( hwnd,
  291. IDC_CB_KEYBOARD_LAYOUT,
  292. CB_SETITEMDATA,
  293. iComboBoxIndex,
  294. (LPARAM) CurrentLocale );
  295. }
  296. }
  297. //----------------------------------------------------------------------------
  298. //
  299. // Function: OnRegionalCustomInitDialog
  300. //
  301. // Purpose: Populates the locale combo boxes and selects the proper entry.
  302. //
  303. // Arguments: HWND hwnd - handle to the dialog box
  304. //
  305. // Returns: VOID
  306. //
  307. //----------------------------------------------------------------------------
  308. VOID
  309. OnRegionalCustomInitDialog( IN HWND hwnd ) {
  310. LoadRegionalSettingsComboBoxes( hwnd );
  311. //
  312. // Set the initial selections for each combo box
  313. //
  314. if( GenSettings.szMenuLanguage[0] != '\0' ) {
  315. FindAndSelectInComboBox( GenSettings.szMenuLanguage,
  316. hwnd,
  317. IDC_CB_MENUS );
  318. }
  319. else {
  320. //
  321. // Select the default locale
  322. //
  323. SelectDefaultLocale( hwnd, IDC_CB_MENUS );
  324. }
  325. if( GenSettings.szNumberLanguage[0] != '\0' ) {
  326. FindAndSelectInComboBox( GenSettings.szNumberLanguage,
  327. hwnd,
  328. IDC_CB_UNITS );
  329. }
  330. else {
  331. //
  332. // Select the default locale
  333. //
  334. SelectDefaultLocale( hwnd, IDC_CB_UNITS );
  335. }
  336. if( GenSettings.szLanguageLocaleId[0] != '\0' ) {
  337. FindAndSelectInComboBox( GenSettings.szLanguageLocaleId,
  338. hwnd,
  339. IDC_CB_KEYBOARD_LAYOUT );
  340. }
  341. else {
  342. //
  343. // Select the default locale
  344. //
  345. SelectDefaultLocale( hwnd, IDC_CB_KEYBOARD_LAYOUT );
  346. }
  347. }
  348. //----------------------------------------------------------------------------
  349. //
  350. // Function: RegionalCustomDisplayDlg
  351. //
  352. // Purpose: Dialog procedure for specify individual regional settings
  353. //
  354. // Arguments: standard Win32 dialog proc arguments
  355. //
  356. // Returns: standard Win32 dialog proc return value -- whether the message
  357. // was handled or not
  358. //
  359. //----------------------------------------------------------------------------
  360. INT_PTR CALLBACK
  361. RegionalCustomDisplayDlg( IN HWND hwnd,
  362. IN UINT uMsg,
  363. IN WPARAM wParam,
  364. IN LPARAM lParam) {
  365. BOOL bStatus = TRUE;
  366. switch (uMsg) {
  367. case WM_INITDIALOG:
  368. OnRegionalCustomInitDialog( hwnd );
  369. break;
  370. case WM_COMMAND: {
  371. int nButtonId;
  372. switch ( nButtonId = LOWORD (wParam ) ) {
  373. case IDOK:
  374. StoreLanguageLocales( hwnd );
  375. EndDialog( hwnd, TRUE );
  376. break;
  377. case IDCANCEL:
  378. EndDialog( hwnd, FALSE );
  379. break;
  380. }
  381. }
  382. default:
  383. bStatus = FALSE;
  384. break;
  385. }
  386. return( bStatus );
  387. }
  388. // *************************************************************************
  389. //
  390. // Dialog proc and helper functions for the Regional Settings Wizard page
  391. //
  392. // *************************************************************************
  393. //----------------------------------------------------------------------------
  394. //
  395. // Function: OnCustomizeCheckBox
  396. //
  397. // Purpose: Greys and ungreys controls appropriately depending on if the
  398. // customize check box is checked or not.
  399. //
  400. // Arguments: IN HWND hwnd - handle to the dialog box
  401. //
  402. // Returns: VOID
  403. //
  404. //----------------------------------------------------------------------------
  405. VOID
  406. OnCustomizeCheckBox( IN HWND hwnd ) {
  407. if( IsDlgButtonChecked( hwnd, IDC_CHB_CUSTOMIZE ) ) {
  408. EnableWindow( GetDlgItem( hwnd, IDC_LANG_TEXT ), FALSE );
  409. EnableWindow( GetDlgItem( hwnd, IDC_CB_LANGUAGE_LOCALE ), FALSE );
  410. EnableWindow( GetDlgItem( hwnd, IDC_BUT_CUSTOM ), TRUE );
  411. }
  412. else {
  413. EnableWindow( GetDlgItem( hwnd, IDC_LANG_TEXT ), TRUE );
  414. EnableWindow( GetDlgItem( hwnd, IDC_CB_LANGUAGE_LOCALE ), TRUE );
  415. EnableWindow( GetDlgItem( hwnd, IDC_BUT_CUSTOM ), FALSE );
  416. }
  417. }
  418. //----------------------------------------------------------------------------
  419. //
  420. // Function: OnRadioButtonRegionalSettings
  421. //
  422. // Purpose: Greys and ungreys controls appropriately depending on what radio
  423. // button is selected
  424. //
  425. // Arguments: IN HWND hwnd - handle to the dialog box
  426. // IN INT nButtonId - resource Id of the button that was clicked
  427. //
  428. // Returns: VOID
  429. //
  430. //----------------------------------------------------------------------------
  431. VOID
  432. OnRadioButtonRegionalSettings( IN HWND hwnd,
  433. IN INT nButtonId ) {
  434. if( nButtonId == IDC_RB_SPECIFY ) {
  435. EnableWindow( GetDlgItem( hwnd, IDC_CHB_CUSTOMIZE ), TRUE );
  436. OnCustomizeCheckBox( hwnd );
  437. }
  438. else {
  439. EnableWindow( GetDlgItem( hwnd, IDC_LANG_TEXT ), FALSE );
  440. EnableWindow( GetDlgItem( hwnd, IDC_CB_LANGUAGE_LOCALE ), FALSE );
  441. EnableWindow( GetDlgItem( hwnd, IDC_CHB_CUSTOMIZE ), FALSE );
  442. EnableWindow( GetDlgItem( hwnd, IDC_BUT_CUSTOM ), FALSE );
  443. }
  444. }
  445. //----------------------------------------------------------------------------
  446. //
  447. // Function: OnRegionalSettingsInitDialog
  448. //
  449. // Purpose: Loads the locale combo box with the locale strings and selects
  450. // the default entry.
  451. //
  452. // Arguments: IN HWND hwnd - handle to the dialog box
  453. //
  454. // Returns: VOID
  455. //
  456. //----------------------------------------------------------------------------
  457. VOID
  458. OnRegionalSettingsInitDialog( IN HWND hwnd ) {
  459. INT_PTR iComboBoxIndex;
  460. LANGUAGELOCALE_NODE *CurrentLocale;
  461. CheckRadioButton( hwnd,
  462. IDC_RB_SKIP,
  463. IDC_RB_SPECIFY,
  464. IDC_RB_SKIP );
  465. //
  466. // Set the initial controls that are greyed/ungreyed
  467. //
  468. OnRadioButtonRegionalSettings( hwnd, IDC_RB_USE_DEFAULT );
  469. //
  470. // Add the language locals to the combo box
  471. //
  472. for( CurrentLocale = FixedGlobals.LanguageLocaleList;
  473. CurrentLocale != NULL;
  474. CurrentLocale = CurrentLocale->next ) {
  475. //
  476. // Add the locale to the combo box
  477. //
  478. iComboBoxIndex = SendDlgItemMessage( hwnd,
  479. IDC_CB_LANGUAGE_LOCALE,
  480. CB_ADDSTRING,
  481. 0,
  482. (LPARAM) CurrentLocale->szLanguageLocaleName );
  483. //
  484. // Associate the Language Locale ID with its entry in the combo box
  485. //
  486. SendDlgItemMessage( hwnd,
  487. IDC_CB_LANGUAGE_LOCALE,
  488. CB_SETITEMDATA,
  489. iComboBoxIndex,
  490. (LPARAM) CurrentLocale );
  491. }
  492. //
  493. // Select the default locale
  494. //
  495. SelectDefaultLocale( hwnd, IDC_CB_LANGUAGE_LOCALE );
  496. }
  497. //----------------------------------------------------------------------------
  498. //
  499. // Function: OnRegionalSettingsSetActive
  500. //
  501. // Purpose:
  502. //
  503. // Arguments: IN HWND hwnd - handle to the dialog box
  504. //
  505. // Returns: VOID
  506. //
  507. //----------------------------------------------------------------------------
  508. static VOID
  509. OnRegionalSettingsSetActive( IN HWND hwnd )
  510. {
  511. if( GenSettings.iUnattendMode == UMODE_FULL_UNATTENDED )
  512. {
  513. EnableWindow( GetDlgItem( hwnd, IDC_RB_SKIP ), FALSE );
  514. }
  515. else
  516. {
  517. EnableWindow( GetDlgItem( hwnd, IDC_RB_SKIP ), TRUE );
  518. }
  519. switch( GenSettings.iRegionalSettings ) {
  520. case REGIONAL_SETTINGS_SKIP:
  521. if( GenSettings.iUnattendMode == UMODE_FULL_UNATTENDED )
  522. {
  523. CheckRadioButton( hwnd,
  524. IDC_RB_SKIP,
  525. IDC_RB_SPECIFY,
  526. IDC_RB_USE_DEFAULT );
  527. }
  528. else
  529. {
  530. CheckRadioButton( hwnd,
  531. IDC_RB_SKIP,
  532. IDC_RB_SPECIFY,
  533. IDC_RB_SKIP );
  534. }
  535. OnRadioButtonRegionalSettings( hwnd, IDC_RB_SKIP );
  536. break;
  537. case REGIONAL_SETTINGS_NOT_SPECIFIED:
  538. case REGIONAL_SETTINGS_DEFAULT:
  539. CheckRadioButton( hwnd,
  540. IDC_RB_SKIP,
  541. IDC_RB_SPECIFY,
  542. IDC_RB_USE_DEFAULT );
  543. OnRadioButtonRegionalSettings( hwnd, IDC_RB_USE_DEFAULT );
  544. break;
  545. case REGIONAL_SETTINGS_SPECIFY:
  546. CheckRadioButton( hwnd,
  547. IDC_RB_SKIP,
  548. IDC_RB_SPECIFY,
  549. IDC_RB_SPECIFY );
  550. OnRadioButtonRegionalSettings( hwnd, IDC_RB_SPECIFY );
  551. if( GenSettings.bUseCustomLocales ) {
  552. CheckDlgButton( hwnd, IDC_CHB_CUSTOMIZE, BST_CHECKED );
  553. OnCustomizeCheckBox( hwnd );
  554. }
  555. else {
  556. FindAndSelectInComboBox( GenSettings.szLanguage,
  557. hwnd,
  558. IDC_CB_LANGUAGE_LOCALE );
  559. CheckDlgButton( hwnd, IDC_CHB_CUSTOMIZE, BST_UNCHECKED );
  560. OnCustomizeCheckBox( hwnd );
  561. }
  562. break;
  563. default:
  564. AssertMsg(FALSE, "Bad case for Regional Settings");
  565. break;
  566. }
  567. }
  568. //----------------------------------------------------------------------------
  569. //
  570. // Function: OnWizNextRegionalSettings
  571. //
  572. // Purpose: Store the radio button choice that was made and the language
  573. // locale, if necessary.
  574. //
  575. // Arguments: IN HWND hwnd - handle to the dialog box
  576. //
  577. // Returns: BOOL
  578. //
  579. //----------------------------------------------------------------------------
  580. BOOL
  581. OnWizNextRegionalSettings( IN HWND hwnd ) {
  582. BOOL bResult = TRUE;
  583. if( IsDlgButtonChecked( hwnd, IDC_RB_SKIP ) ) {
  584. if( GenSettings.iUnattendMode == UMODE_FULL_UNATTENDED ) {
  585. ReportErrorId( hwnd,
  586. MSGTYPE_ERR,
  587. IDS_ERR_FULL_UNATTEND_REGION_SET );
  588. bResult = FALSE;
  589. }
  590. else {
  591. GenSettings.iRegionalSettings = REGIONAL_SETTINGS_SKIP;
  592. }
  593. }
  594. else if( IsDlgButtonChecked( hwnd, IDC_RB_USE_DEFAULT ) ) {
  595. GenSettings.iRegionalSettings = REGIONAL_SETTINGS_DEFAULT;
  596. }
  597. else {
  598. GenSettings.iRegionalSettings = REGIONAL_SETTINGS_SPECIFY;
  599. if( IsDlgButtonChecked( hwnd, IDC_CHB_CUSTOMIZE ) ) {
  600. GenSettings.bUseCustomLocales = TRUE;
  601. }
  602. else {
  603. INT_PTR iComboBoxIndex;
  604. LANGUAGELOCALE_NODE *pLocaleEntry;
  605. GenSettings.bUseCustomLocales = FALSE;
  606. //
  607. // Grab the language locale
  608. //
  609. iComboBoxIndex = SendDlgItemMessage( hwnd,
  610. IDC_CB_LANGUAGE_LOCALE,
  611. CB_GETCURSEL,
  612. 0,
  613. 0 );
  614. pLocaleEntry = (LANGUAGELOCALE_NODE *) SendDlgItemMessage( hwnd,
  615. IDC_CB_LANGUAGE_LOCALE,
  616. CB_GETITEMDATA,
  617. iComboBoxIndex,
  618. 0 );
  619. lstrcpyn( GenSettings.szLanguage,
  620. pLocaleEntry->szLanguageLocaleId, AS(GenSettings.szLanguage) );
  621. }
  622. }
  623. return ( bResult );
  624. }
  625. //----------------------------------------------------------------------------
  626. //
  627. // Function: DlgRegionalSettingsPage
  628. //
  629. // Purpose: Dialog procedure for the Regional Settings page
  630. //
  631. // Arguments: standard Win32 dialog proc arguments
  632. //
  633. // Returns: standard Win32 dialog proc return value -- whether the message
  634. // was handled or not
  635. //
  636. //----------------------------------------------------------------------------
  637. INT_PTR CALLBACK
  638. DlgRegionalSettingsPage( IN HWND hwnd,
  639. IN UINT uMsg,
  640. IN WPARAM wParam,
  641. IN LPARAM lParam ) {
  642. BOOL bStatus = TRUE;
  643. switch( uMsg ) {
  644. case WM_INITDIALOG: {
  645. OnRegionalSettingsInitDialog( hwnd );
  646. break;
  647. }
  648. case WM_COMMAND: {
  649. int nButtonId;
  650. switch ( nButtonId = LOWORD(wParam) ) {
  651. case IDC_BUT_CUSTOM:
  652. if( HIWORD( wParam ) == BN_CLICKED ) {
  653. OnRegionalCustomButton( hwnd );
  654. }
  655. break;
  656. case IDC_CHB_CUSTOMIZE:
  657. if( HIWORD( wParam ) == BN_CLICKED ) {
  658. OnCustomizeCheckBox( hwnd );
  659. }
  660. break;
  661. case IDC_RB_SKIP:
  662. case IDC_RB_USE_DEFAULT:
  663. case IDC_RB_SPECIFY:
  664. if( HIWORD( wParam ) == BN_CLICKED )
  665. OnRadioButtonRegionalSettings( hwnd, nButtonId );
  666. break;
  667. default:
  668. bStatus = FALSE;
  669. break;
  670. }
  671. break;
  672. }
  673. case WM_NOTIFY: {
  674. LPNMHDR pnmh = (LPNMHDR)lParam;
  675. switch( pnmh->code ) {
  676. case PSN_QUERYCANCEL:
  677. WIZ_CANCEL(hwnd);
  678. break;
  679. case PSN_SETACTIVE: {
  680. g_App.dwCurrentHelp = IDH_REGN_STGS;
  681. OnRegionalSettingsSetActive( hwnd );
  682. WIZ_BUTTONS(hwnd, PSWIZB_BACK | PSWIZB_NEXT);
  683. break;
  684. }
  685. case PSN_WIZBACK:
  686. bStatus = FALSE;
  687. break;
  688. case PSN_WIZNEXT: {
  689. if ( !OnWizNextRegionalSettings( hwnd ) )
  690. WIZ_FAIL(hwnd);
  691. else
  692. bStatus = FALSE;
  693. }
  694. break;
  695. case PSN_HELP:
  696. WIZ_HELP();
  697. break;
  698. default:
  699. break;
  700. }
  701. break;
  702. }
  703. default:
  704. bStatus = FALSE;
  705. break;
  706. }
  707. return( bStatus );
  708. }