timedlg.c
Upload User: caisha3
Upload Date: 2013-09-21
Package Size: 208739k
Code Size: 21k
Category:

Windows Develop

Development Platform:

Visual C++

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