Calendar and DTP Controls

Windows Mobile SupportedWindows Embedded CE Not Supported

8/28/2008

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

Shell Application Development

Relevant APIs

Shell Reference

Date and Time Picker Controls Reference API

Month Calendar Controls Reference API

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 Mobile 6 SDK\Samples\PocketPC\CPP\win32\CalendarAndDTP

    Microsoft Visual Studio 2005 launches and loads the solution.

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

  3. Deploy the solution (F5).

Development Environments

SDK: Windows Mobile 6 Professional SDK and Windows Mobile 6 Standard SDK

Development Environment: Visual Studio 2005.

ActiveSync: Version 4.5.

Demonstrates

ExTAPIAsync demonstrates how to develop an application that is based on Extended TAPI asynchronous functionality.

Comments

The following code is needed to use the calendar and DTP controls.

INITCOMMONCONTROLSEX icex;
icex.dwSize = sizeof(icex);

icex.dwICC = ICC_DATE_CLASSES;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.

See Also

Concepts

Code Samples for Windows Mobile

Other Resources

Window Control Reference