Creating a Date and Time Picker Control (Windows Embedded CE 6.0)

1/6/2010

The date and time picker is a control that displays information about dates and times, and provides the user with an easy way to modify this information. Each field in the control displays a time element, such as month, day, hour, or minute. A user selects a field by tapping it with the stylus, and then types a new value from the keyboard.

The way in which date and time information is displayed is determined by a format string. A date and time picker control can display time information in any of three preset formats, or you can create custom format strings to specify a different order in which to display the fields. You also can add customized date and time information to a date and time picker control by using callback fields.

To create a date and time picker control

  1. Specify the DATETIMEPICK_CLASS class in the lpClassName parameter of the CreateWindowEx function.

    This class is registered when the DLL for the common control is loaded. You can use the InitCommonControls function to ensure that this DLL is loaded. To register the date and time picker class by using the InitCommonControlsEx function, specify the ICC_DATE_CLASSES flag as the dwICC member of the INITCOMMONCONTROLSEX structure that you pass in the lpInitCtrls parameter.

  2. Specify a date and time picker style in the dwStyle parameter of the CreateWindowEx function.

    The following screen shot shows the Windows Embedded CE date and time picker.

    Ee501769.895e4e3b-c92d-4642-ab82-6c62c0e95bf0(en-US,WinEmbedded.60).gif

    For a complete listing of supported styles, see Window and Control Styles.

See Also

Concepts

Working with Common Controls