Leaked source code of windows server 2003
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.

764 lines
23 KiB

  1. /*++
  2. Copyright (c) 1994-2000, Microsoft Corporation All rights reserved.
  3. Module Name:
  4. timedlg.c
  5. Abstract:
  6. This module implements the time property sheet for the Regional
  7. Options applet.
  8. Revision History:
  9. --*/
  10. //
  11. // Include Files.
  12. //
  13. #include "intl.h"
  14. #include <windowsx.h>
  15. #include <tchar.h>
  16. #include "intlhlp.h"
  17. #include "maxvals.h"
  18. #define STRSAFE_LIB
  19. #include <strsafe.h>
  20. //
  21. // Global Variables.
  22. //
  23. static TCHAR sz_s1159[MAX_S1159 + 1];
  24. static TCHAR sz_s2359[MAX_S2359 + 1];
  25. static TCHAR sz_sTime[MAX_STIME + 1];
  26. static TCHAR sz_sTimeFormat[MAX_FORMAT + 1];
  27. TCHAR szNLS_TimeStyle[SIZE_128];
  28. //
  29. // Context Help Ids.
  30. //
  31. static int aTimeHelpIds[] =
  32. {
  33. IDC_GROUPBOX1, IDH_COMM_GROUPBOX,
  34. IDC_SAMPLELBL1, IDH_INTL_TIME_SAMPLE,
  35. IDC_SAMPLE1, IDH_INTL_TIME_SAMPLE,
  36. IDC_SAMPLE1A, IDH_INTL_TIME_SAMPLE_ARABIC,
  37. IDC_TIME_STYLE, IDH_INTL_TIME_FORMAT,
  38. IDC_SEPARATOR, IDH_INTL_TIME_SEPARATOR,
  39. IDC_AM_SYMBOL, IDH_INTL_TIME_AMSYMBOL,
  40. IDC_PM_SYMBOL, IDH_INTL_TIME_PMSYMBOL,
  41. IDC_GROUPBOX2, IDH_INTL_TIME_FORMAT_NOTATION,
  42. IDC_SAMPLE2, IDH_INTL_TIME_FORMAT_NOTATION,
  43. 0, 0
  44. };
  45. ////////////////////////////////////////////////////////////////////////////
  46. //
  47. // Time_DisplaySample
  48. //
  49. // Update the Time sample. Format the time based on the user's
  50. // current locale settings.
  51. //
  52. ////////////////////////////////////////////////////////////////////////////
  53. void Time_DisplaySample(
  54. HWND hDlg)
  55. {
  56. TCHAR szBuf[MAX_SAMPLE_SIZE];
  57. //
  58. // Show or hide the Arabic info based on the current user locale id.
  59. //
  60. ShowWindow(GetDlgItem(hDlg, IDC_SAMPLE1A), bShowArabic ? SW_SHOW : SW_HIDE);
  61. //
  62. // Get the string representing the time format for the current system
  63. // time and display it. If the sample in the buffer is valid, display
  64. // it. Otherwise, display a message box indicating that there is a
  65. // problem retrieving the locale information.
  66. //
  67. if (GetTimeFormat(UserLocaleID, 0, NULL, NULL, szBuf, MAX_SAMPLE_SIZE))
  68. {
  69. SetDlgItemText(hDlg, IDC_SAMPLE1, szBuf);
  70. if (bShowArabic)
  71. {
  72. SetDlgItemText(hDlg, IDC_SAMPLE1A, szBuf);
  73. SetDlgItemRTL(hDlg, IDC_SAMPLE1A);
  74. }
  75. }
  76. else
  77. {
  78. MessageBox(hDlg, szLocaleGetError, NULL, MB_OK | MB_ICONINFORMATION);
  79. }
  80. }
  81. ////////////////////////////////////////////////////////////////////////////
  82. //
  83. // Time_SaveValues
  84. //
  85. // Save values in the case that we need to restore them.
  86. //
  87. ////////////////////////////////////////////////////////////////////////////
  88. void Time_SaveValues()
  89. {
  90. //
  91. // Save registry values.
  92. //
  93. if (!GetLocaleInfo( UserLocaleID,
  94. LOCALE_S1159,
  95. sz_s1159,
  96. MAX_S1159 + 1 ))
  97. {
  98. //_tcscpy(sz_s1159, TEXT("AM"));
  99. if(FAILED(StringCchCopy(sz_s1159, MAX_S1159+1, TEXT("AM"))))
  100. {
  101. // This should be impossible, but we need to avoid PREfast complaints.
  102. }
  103. }
  104. if (!GetLocaleInfo( UserLocaleID,
  105. LOCALE_S2359,
  106. sz_s2359,
  107. MAX_S2359 + 1 ))
  108. {
  109. //_tcscpy(sz_s2359, TEXT("PM"));
  110. if(FAILED(StringCchCopy(sz_s2359, MAX_S2359+1, TEXT("PM"))))
  111. {
  112. // This should be impossible, but we need to avoid PREfast complaints.
  113. }
  114. }
  115. if (!GetLocaleInfo( UserLocaleID,
  116. LOCALE_STIME,
  117. sz_sTime,
  118. MAX_STIME + 1 ))
  119. {
  120. //_tcscpy(sz_sTime, TEXT(":"));
  121. if(FAILED(StringCchCopy(sz_sTime, MAX_STIME+1, TEXT(":"))))
  122. {
  123. // This should be impossible, but we need to avoid PREfast complaints.
  124. }
  125. }
  126. if (!GetLocaleInfo( UserLocaleID,
  127. LOCALE_STIMEFORMAT,
  128. sz_sTimeFormat,
  129. MAX_FORMAT + 1 ))
  130. {
  131. //_tcscpy(sz_sTimeFormat, TEXT("h:mm:ss tt"));
  132. if(FAILED(StringCchCopy(sz_sTimeFormat, MAX_FORMAT+1, TEXT("h:mm:ss tt"))))
  133. {
  134. // This should be impossible, but we need to avoid PREfast complaints.
  135. }
  136. }
  137. }
  138. ////////////////////////////////////////////////////////////////////////////
  139. //
  140. // Time_RestoreValues
  141. //
  142. ////////////////////////////////////////////////////////////////////////////
  143. void Time_RestoreValues()
  144. {
  145. if (g_dwCustChange & Process_Time)
  146. {
  147. SetLocaleInfo(UserLocaleID, LOCALE_S1159, sz_s1159);
  148. SetLocaleInfo(UserLocaleID, LOCALE_S2359, sz_s2359);
  149. SetLocaleInfo(UserLocaleID, LOCALE_STIME, sz_sTime);
  150. SetLocaleInfo(UserLocaleID, LOCALE_STIMEFORMAT, sz_sTimeFormat);
  151. }
  152. }
  153. ////////////////////////////////////////////////////////////////////////////
  154. //
  155. // Time_ClearValues
  156. //
  157. // Reset each of the list boxes in the time property sheet page.
  158. //
  159. ////////////////////////////////////////////////////////////////////////////
  160. void Time_ClearValues(
  161. HWND hDlg)
  162. {
  163. ComboBox_ResetContent(GetDlgItem(hDlg, IDC_AM_SYMBOL));
  164. ComboBox_ResetContent(GetDlgItem(hDlg, IDC_PM_SYMBOL));
  165. ComboBox_ResetContent(GetDlgItem(hDlg, IDC_SEPARATOR));
  166. ComboBox_ResetContent(GetDlgItem(hDlg, IDC_TIME_STYLE));
  167. }
  168. ////////////////////////////////////////////////////////////////////////////
  169. //
  170. // Time_SetValues
  171. //
  172. // Initialize all of the controls in the time property sheet page.
  173. //
  174. ////////////////////////////////////////////////////////////////////////////
  175. void Time_SetValues(
  176. HWND hDlg)
  177. {
  178. TCHAR szBuf[SIZE_128];
  179. DWORD dwIndex;
  180. HWND hCtrl = GetDlgItem(hDlg, IDC_TIME_STYLE);
  181. //
  182. // Initialize the dropdown box for the current locale setting for:
  183. // AM Symbol, PM Symbol, and Time Separator.
  184. //
  185. DropDown_Use_Locale_Values(hDlg, LOCALE_S1159, IDC_AM_SYMBOL);
  186. DropDown_Use_Locale_Values(hDlg, LOCALE_S2359, IDC_PM_SYMBOL);
  187. DropDown_Use_Locale_Values(hDlg, LOCALE_STIME, IDC_SEPARATOR);
  188. //
  189. // Initialize and Lock function. If it succeeds, call enum function to
  190. // enumerate all possible values for the list box via a call to EnumProc.
  191. // EnumProc will call Set_List_Values for each of the string values it
  192. // receives. When the enumeration of values is complete, call
  193. // Set_List_Values to clear the dialog item specific data and to clear
  194. // the lock on the function. Perform this set of operations for all of
  195. // the Time Styles.
  196. //
  197. if (Set_List_Values(hDlg, IDC_TIME_STYLE, 0))
  198. {
  199. EnumTimeFormats(EnumProc, UserLocaleID, 0);
  200. Set_List_Values(0, IDC_TIME_STYLE, 0);
  201. dwIndex = 0;
  202. if (GetLocaleInfo(UserLocaleID, LOCALE_STIMEFORMAT, szBuf, SIZE_128))
  203. {
  204. dwIndex = ComboBox_FindString(hCtrl, -1, szBuf);
  205. }
  206. else
  207. {
  208. MessageBox(hDlg, szLocaleGetError, NULL, MB_OK | MB_ICONINFORMATION);
  209. }
  210. Localize_Combobox_Styles(hDlg, IDC_TIME_STYLE, LOCALE_STIMEFORMAT);
  211. ComboBox_SetCurSel(hCtrl, dwIndex);
  212. }
  213. //
  214. // Display the current sample that represents all of the locale settings.
  215. //
  216. Time_DisplaySample(hDlg);
  217. }
  218. ////////////////////////////////////////////////////////////////////////////
  219. //
  220. // Time_ApplySettings
  221. //
  222. // For every control that has changed (that affects the Locale settings),
  223. // call Set_Locale_Values to update the user locale information. Notify
  224. // the parent of changes and reset the change flag stored in the property
  225. // sheet page structure appropriately. Redisplay the time sample if
  226. // bRedisplay is TRUE.
  227. //
  228. ////////////////////////////////////////////////////////////////////////////
  229. BOOL Time_ApplySettings(
  230. HWND hDlg,
  231. BOOL bRedisplay)
  232. {
  233. TCHAR szBuf[SIZE_128];
  234. DWORD dwIndex;
  235. HWND hCtrl;
  236. LPPROPSHEETPAGE lpPropSheet = (LPPROPSHEETPAGE)(GetWindowLongPtr(hDlg, DWLP_USER));
  237. LPARAM Changes = lpPropSheet->lParam;
  238. if (Changes & TC_1159)
  239. {
  240. if (!Set_Locale_Values( hDlg,
  241. LOCALE_S1159,
  242. IDC_AM_SYMBOL,
  243. TEXT("s1159"),
  244. FALSE,
  245. 0,
  246. 0,
  247. NULL ))
  248. {
  249. return (FALSE);
  250. }
  251. }
  252. if (Changes & TC_2359)
  253. {
  254. if (!Set_Locale_Values( hDlg,
  255. LOCALE_S2359,
  256. IDC_PM_SYMBOL,
  257. TEXT("s2359"),
  258. FALSE,
  259. 0,
  260. 0,
  261. NULL ))
  262. {
  263. return (FALSE);
  264. }
  265. }
  266. if (Changes & TC_TimeFmt)
  267. {
  268. //
  269. // szNLS_TimeStyle is set in Time_ValidatePPS.
  270. //
  271. if (!Set_Locale_Values( hDlg,
  272. LOCALE_STIMEFORMAT,
  273. IDC_TIME_STYLE,
  274. 0,
  275. FALSE,
  276. 0,
  277. 0,
  278. szNLS_TimeStyle ))
  279. {
  280. return (FALSE);
  281. }
  282. #ifndef WINNT
  283. //
  284. // The time marker gets:
  285. // set to Null for 24 hour format and
  286. // doesn't change for 12 hour format.
  287. //
  288. GetProfileString(szIntl, TEXT("iTime"), TEXT("0"), pTestBuf, 10);
  289. if (*pTestBuf == TC_FullTime)
  290. {
  291. SetLocaleInfo(UserLocaleID, LOCALE_S1159, TEXT(""));
  292. SetLocaleInfo(UserLocaleID, LOCALE_S2359, TEXT(""));
  293. }
  294. else
  295. {
  296. //
  297. // Set time marker in the registry.
  298. //
  299. if (!Set_Locale_Values( 0,
  300. LOCALE_S1159,
  301. 0,
  302. TEXT("s1159"),
  303. TRUE,
  304. 0,
  305. 0,
  306. NULL ))
  307. {
  308. return (FALSE);
  309. }
  310. if (!Set_Locale_Values( 0,
  311. LOCALE_S2359,
  312. 0,
  313. TEXT("s2359"),
  314. TRUE,
  315. 0,
  316. 0,
  317. NULL ))
  318. {
  319. return (FALSE);
  320. }
  321. }
  322. #endif
  323. //
  324. // If the time separator has areadly been changed, then don't update
  325. // it now as it will be updated down below.
  326. //
  327. if (!(Changes & TC_STime))
  328. {
  329. //
  330. // Since the time style changed, reset time separator list box.
  331. //
  332. ComboBox_ResetContent(GetDlgItem(hDlg, IDC_SEPARATOR));
  333. DropDown_Use_Locale_Values(hDlg, LOCALE_STIME, IDC_SEPARATOR);
  334. if (!Set_Locale_Values( hDlg,
  335. LOCALE_STIME,
  336. IDC_SEPARATOR,
  337. TEXT("sTime"),
  338. FALSE,
  339. 0,
  340. 0,
  341. NULL ))
  342. {
  343. return (FALSE);
  344. }
  345. }
  346. //
  347. // Also need to reset the AM and PM list boxes.
  348. //
  349. ComboBox_ResetContent(GetDlgItem(hDlg, IDC_AM_SYMBOL));
  350. ComboBox_ResetContent(GetDlgItem(hDlg, IDC_PM_SYMBOL));
  351. DropDown_Use_Locale_Values(hDlg, LOCALE_S1159, IDC_AM_SYMBOL);
  352. DropDown_Use_Locale_Values(hDlg, LOCALE_S2359, IDC_PM_SYMBOL);
  353. }
  354. if (Changes & TC_STime)
  355. {
  356. if (!Set_Locale_Values( hDlg,
  357. LOCALE_STIME,
  358. IDC_SEPARATOR,
  359. TEXT("sTime"),
  360. FALSE,
  361. 0,
  362. 0,
  363. NULL ))
  364. {
  365. return (FALSE);
  366. }
  367. //
  368. // Since the time separator changed, update the time style
  369. // list box.
  370. //
  371. hCtrl = GetDlgItem(hDlg, IDC_TIME_STYLE);
  372. ComboBox_ResetContent(hCtrl);
  373. if (Set_List_Values(hDlg, IDC_TIME_STYLE, 0))
  374. {
  375. EnumTimeFormats(EnumProc, UserLocaleID, 0);
  376. Set_List_Values(0, IDC_TIME_STYLE, 0);
  377. dwIndex = 0;
  378. if (GetLocaleInfo(UserLocaleID, LOCALE_STIMEFORMAT, szBuf, SIZE_128))
  379. {
  380. dwIndex = ComboBox_FindString(hCtrl, -1, szBuf);
  381. }
  382. else
  383. {
  384. MessageBox(hDlg, szLocaleGetError, NULL, MB_OK | MB_ICONINFORMATION);
  385. }
  386. Localize_Combobox_Styles( hDlg,
  387. IDC_TIME_STYLE,
  388. LOCALE_STIMEFORMAT );
  389. ComboBox_SetCurSel(hCtrl, dwIndex);
  390. }
  391. }
  392. PropSheet_UnChanged(GetParent(hDlg), hDlg);
  393. lpPropSheet->lParam = TC_EverChg;
  394. //
  395. // Display the current sample that represents all of the locale settings.
  396. //
  397. if (bRedisplay)
  398. {
  399. Time_DisplaySample(hDlg);
  400. }
  401. //
  402. // Changes made in the second level.
  403. //
  404. if (Changes)
  405. {
  406. g_dwCustChange |= Process_Time;
  407. }
  408. //
  409. // Return success.
  410. //
  411. return (TRUE);
  412. }
  413. ////////////////////////////////////////////////////////////////////////////
  414. //
  415. // Time_ValidatePPS
  416. //
  417. // Validate each of the combo boxes whose values are constrained.
  418. // If any of the input fails, notify the user and then return FALSE
  419. // to indicate validation failure.
  420. //
  421. ////////////////////////////////////////////////////////////////////////////
  422. BOOL Time_ValidatePPS(
  423. HWND hDlg,
  424. LPARAM Changes)
  425. {
  426. //
  427. // If nothing has changed, return TRUE immediately.
  428. //
  429. if (Changes <= TC_EverChg)
  430. {
  431. return (TRUE);
  432. }
  433. //
  434. // If the AM symbol has changed, ensure that there are no digits
  435. // contained in the new symbol.
  436. //
  437. if (Changes & TC_1159 &&
  438. Item_Has_Digits(hDlg, IDC_AM_SYMBOL, TRUE))
  439. {
  440. No_Numerals_Error(hDlg, IDC_AM_SYMBOL, IDS_LOCALE_AM_SYM);
  441. return (FALSE);
  442. }
  443. //
  444. // If the PM symbol has changed, ensure that there are no digits
  445. // contained in the new symbol.
  446. //
  447. if (Changes & TC_2359 &&
  448. Item_Has_Digits(hDlg, IDC_PM_SYMBOL, TRUE))
  449. {
  450. No_Numerals_Error(hDlg, IDC_PM_SYMBOL, IDS_LOCALE_PM_SYM);
  451. return (FALSE);
  452. }
  453. //
  454. // If the time separator has changed, ensure that there are no digits
  455. // and no invalid characters contained in the new separator.
  456. //
  457. if (Changes & TC_STime &&
  458. Item_Has_Digits_Or_Invalid_Chars( hDlg,
  459. IDC_SEPARATOR,
  460. FALSE,
  461. szInvalidSTime ))
  462. {
  463. No_Numerals_Error(hDlg, IDC_SEPARATOR, IDS_LOCALE_TIME_SEP);
  464. return (FALSE);
  465. }
  466. //
  467. // If the time style has changed, ensure that there are only characters
  468. // in this set " Hhmst,-./:;\" or localized equivalent, the separator
  469. // string, and text enclosed in single quotes.
  470. //
  471. if (Changes & TC_TimeFmt)
  472. {
  473. if (NLSize_Style( hDlg,
  474. IDC_TIME_STYLE,
  475. szNLS_TimeStyle,
  476. LOCALE_STIMEFORMAT ) ||
  477. Item_Check_Invalid_Chars( hDlg,
  478. szNLS_TimeStyle,
  479. szTimeChars,
  480. IDC_SEPARATOR,
  481. FALSE,
  482. szTCaseSwap,
  483. IDC_TIME_STYLE ))
  484. {
  485. Invalid_Chars_Error(hDlg, IDC_TIME_STYLE, IDS_LOCALE_TIME);
  486. return (FALSE);
  487. }
  488. }
  489. //
  490. // Return success.
  491. //
  492. return (TRUE);
  493. }
  494. ////////////////////////////////////////////////////////////////////////////
  495. //
  496. // Time_InitPropSheet
  497. //
  498. // The extra long value for the property sheet page is used as a set of
  499. // state or change flags for each of the list boxes in the property sheet.
  500. // Initialize this value to 0. Call Time_SetValues with the property
  501. // sheet handle to initialize all of the property sheet controls. Limit
  502. // the length of the text in some of the ComboBoxes.
  503. //
  504. ////////////////////////////////////////////////////////////////////////////
  505. void Time_InitPropSheet(
  506. HWND hDlg,
  507. LPARAM lParam)
  508. {
  509. //
  510. // The lParam holds a pointer to the property sheet page. Save it
  511. // for later reference.
  512. //
  513. SetWindowLongPtr(hDlg, DWLP_USER, lParam);
  514. Time_SetValues(hDlg);
  515. szNLS_TimeStyle[0] = 0;
  516. ComboBox_LimitText(GetDlgItem(hDlg, IDC_AM_SYMBOL), MAX_S1159);
  517. ComboBox_LimitText(GetDlgItem(hDlg, IDC_PM_SYMBOL), MAX_S2359);
  518. ComboBox_LimitText(GetDlgItem(hDlg, IDC_SEPARATOR), MAX_STIME);
  519. ComboBox_LimitText(GetDlgItem(hDlg, IDC_TIME_STYLE), MAX_FORMAT);
  520. }
  521. ////////////////////////////////////////////////////////////////////////////
  522. //
  523. // TimeDlgProc
  524. //
  525. ////////////////////////////////////////////////////////////////////////////
  526. INT_PTR CALLBACK TimeDlgProc(
  527. HWND hDlg,
  528. UINT message,
  529. WPARAM wParam,
  530. LPARAM lParam)
  531. {
  532. NMHDR *lpnm;
  533. LPPROPSHEETPAGE lpPropSheet = (LPPROPSHEETPAGE)(GetWindowLongPtr(hDlg, DWLP_USER));
  534. switch (message)
  535. {
  536. case ( WM_NOTIFY ) :
  537. {
  538. lpnm = (NMHDR *)lParam;
  539. switch (lpnm->code)
  540. {
  541. case ( PSN_SETACTIVE ) :
  542. {
  543. //
  544. // If there has been a change in the regional Locale
  545. // setting, clear all of the current info in the
  546. // property sheet, get the new values, and update the
  547. // appropriate registry values.
  548. //
  549. if (Verified_Regional_Chg & Process_Time)
  550. {
  551. Verified_Regional_Chg &= ~Process_Time;
  552. Time_ClearValues(hDlg);
  553. Time_SetValues(hDlg);
  554. lpPropSheet->lParam = 0;
  555. }
  556. break;
  557. }
  558. case ( PSN_KILLACTIVE ) :
  559. {
  560. //
  561. // Validate the entries on the property page.
  562. //
  563. SetWindowLongPtr( hDlg,
  564. DWLP_MSGRESULT,
  565. !Time_ValidatePPS( hDlg,
  566. lpPropSheet->lParam ) );
  567. break;
  568. }
  569. case ( PSN_APPLY ) :
  570. {
  571. //
  572. // Apply the settings.
  573. //
  574. if (Time_ApplySettings(hDlg, TRUE))
  575. {
  576. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
  577. //
  578. // Zero out the TC_EverChg bit.
  579. //
  580. lpPropSheet->lParam = 0;
  581. }
  582. else
  583. {
  584. SetWindowLongPtr( hDlg,
  585. DWLP_MSGRESULT,
  586. PSNRET_INVALID_NOCHANGEPAGE );
  587. }
  588. break;
  589. }
  590. default :
  591. {
  592. return (FALSE);
  593. }
  594. }
  595. break;
  596. }
  597. case ( WM_INITDIALOG ) :
  598. {
  599. Time_InitPropSheet(hDlg, lParam);
  600. Time_SaveValues();
  601. break;
  602. }
  603. case ( WM_DESTROY ) :
  604. {
  605. break;
  606. }
  607. case ( WM_HELP ) :
  608. {
  609. WinHelp( (HWND)((LPHELPINFO)lParam)->hItemHandle,
  610. szHelpFile,
  611. HELP_WM_HELP,
  612. (DWORD_PTR)(LPTSTR)aTimeHelpIds );
  613. break;
  614. }
  615. case ( WM_CONTEXTMENU ) : // right mouse click
  616. {
  617. WinHelp( (HWND)wParam,
  618. szHelpFile,
  619. HELP_CONTEXTMENU,
  620. (DWORD_PTR)(LPTSTR)aTimeHelpIds );
  621. break;
  622. }
  623. case ( WM_COMMAND ) :
  624. {
  625. switch (LOWORD(wParam))
  626. {
  627. case ( IDC_AM_SYMBOL ) :
  628. {
  629. if (HIWORD(wParam) == CBN_SELCHANGE ||
  630. HIWORD(wParam) == CBN_EDITCHANGE)
  631. {
  632. lpPropSheet->lParam |= TC_1159;
  633. }
  634. break;
  635. }
  636. case ( IDC_PM_SYMBOL ) :
  637. {
  638. if (HIWORD(wParam) == CBN_SELCHANGE ||
  639. HIWORD(wParam) == CBN_EDITCHANGE)
  640. {
  641. lpPropSheet->lParam |= TC_2359;
  642. }
  643. break;
  644. }
  645. case ( IDC_SEPARATOR ) :
  646. {
  647. if (HIWORD(wParam) == CBN_SELCHANGE ||
  648. HIWORD(wParam) == CBN_EDITCHANGE)
  649. {
  650. lpPropSheet->lParam |= TC_STime;
  651. }
  652. break;
  653. }
  654. case ( IDC_TIME_STYLE ) :
  655. {
  656. if (HIWORD(wParam) == CBN_SELCHANGE ||
  657. HIWORD(wParam) == CBN_EDITCHANGE)
  658. {
  659. lpPropSheet->lParam |= TC_TimeFmt;
  660. }
  661. break;
  662. }
  663. }
  664. //
  665. // Turn on ApplyNow button.
  666. //
  667. if (lpPropSheet->lParam > TC_EverChg)
  668. {
  669. PropSheet_Changed(GetParent(hDlg), hDlg);
  670. }
  671. break;
  672. }
  673. default :
  674. {
  675. return (FALSE);
  676. }
  677. }
  678. //
  679. // Return success.
  680. //
  681. return (TRUE);
  682. }