Share via


Calendar and DTP Controls

Send Feedback

This code sample is named CalendarAndDTP. It demonstrates how to use the Calendar Controls and the Date and Time Picker (DTP) Controls, the use of custom formats in the DTP control, and Calendar Control styles.

Feature Area

Relevant APIs

Usage

To run the code sample

  1. Navigate to the solution file (*.sln), and double-click it. By default, the solution file is copied to the following folder:

    C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Samples\CPP\Win32\Calendaranddtp\``CalendarAndDTP.sln

    Microsoft Visual Studio 2005 launches and loads the solution.

  2. Build the solution (Ctrl+Shift+B).

  3. Deploy the solution (F5).

Initializing the Controls

// Required to use the calendar and DTP controls.
INITCOMMONCONTROLSEX icex;
icex.dwSize = sizeof(icex);
icex.dwICC = ICC_DATE_CLASSES;

Remarks

You can create the second screen with scrollbars, and then pan a full year.

The controls are physically laid out on dialog boxes to make them easier to position and interact with at design time. In the dialog editor, they are the grey boxes on the dialog boxes. To set specific styles for these controls, open the *.RC file as a text file, find the control you want, and add or delete the style. For example, in the *.RC file, there will be a line that looks like this:

CONTROL "",IDC_CONTROL_DTS_LONGDATEFORMAT,"SysDateTimePick32", 0x4,0,0,124,12

Add a new style next to the "0x4", such as "0x4 | DTM_STYLE". It will be changed by the dialog compiler to the correct hex value, provided the <commctrl.h> file is included. It is included in the resource.h file in this example.

Requirements

Pocket PC SDK: Windows Mobile 5.0 Pocket PC SDK.
Smartphone SDK: Windows Mobile 5.0 Smartphone SDK.
Development Environment: Visual Studio 2005.
ActiveSync: Version 4.0.

See Also

Code Samples | Window Control Reference

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.