Date and Time Picker

This section contains information about the API elements used with date and time picker controls.

Overviews

TopicContents
About Date and Time Picker Controls

A date and time picker (DTP) control provides a simple and intuitive interface through which to exchange date and time information with a user.

Using Date and Time Picker Controls

This section provides information and sample code for implementing date and time picker controls.

 

Macros

TopicContents
DateTime_CloseMonthCal

Closes the date and time picker (DTP) control. Use this macro or send the DTM_CLOSEMONTHCAL message explicitly.

DateTime_GetDateTimePickerInfo

Gets information for a specified date and time picker (DTP) control.

DateTime_GetIdealSize

Gets the size needed to display the control without clipping. Use this macro or send the DTM_GETIDEALSIZE message explicitly.

DateTime_GetMonthCal

Gets the handle to a date and time picker's (DTP) child month calendar control. You can use this macro or send the DTM_GETMONTHCAL message explicitly.

DateTime_GetMonthCalColor

Gets the color for a given portion of the month calendar within a date and time picker (DTP) control. You can use this macro or send the DTM_GETMCCOLOR message explicitly.

DateTime_GetMonthCalFont

Gets the font that the date and time picker (DTP) control's child month calendar control is currently using. You can use this macro or send the DTM_GETMCFONT message explicitly.

DateTime_GetMonthCalStyle

Gets the style of a specified DTP control. Use this macro or send the DTM_GETMCSTYLE message explicitly.

DateTime_GetRange

Gets the current minimum and maximum allowable system times for a date and time picker (DTP) control. You can use this macro, or send the DTM_GETRANGE message explicitly.

DateTime_GetSystemtime

Gets the currently selected time from a date and time picker (DTP) control and places it in a specified SYSTEMTIME structure. You can use this macro, or send the DTM_GETSYSTEMTIME message explicitly.

DateTime_SetFormat

Sets the display of a date and time picker (DTP) control based on a given format string. You can use this macro or send the DTM_SETFORMAT message explicitly.

DateTime_SetMonthCalColor

Sets the color for a given portion of the month calendar within a date and time picker (DTP) control. You can use this macro or send the DTM_SETMCCOLOR message explicitly.

DateTime_SetMonthCalFont

Sets the font to be used by the date and time picker (DTP) control's child month calendar control. You can use this macro or explicitly send the DTM_SETMCFONT message.

DateTime_SetMonthCalStyle

Sets the style for a specified DTP control. Use this macro or send the DTM_SETMCSTYLE message explicitly.

DateTime_SetRange

Sets the minimum and maximum allowable system times for a date and time picker (DTP) control. You can use this macro or send the DTM_SETRANGE message explicitly.

DateTime_SetSystemtime

Sets a date and time picker (DTP) control to a given date and time. You can use this macro or send the DTM_SETSYSTEMTIME message explicitly.

 

Messages

TopicContents
DTM_CLOSEMONTHCAL

Closes a DTP control. Send this message explicitly or by using the DateTime_CloseMonthCal macro.

DTM_GETDATETIMEPICKERINFO

Gets information on a date and time picker (DTP) control.

DTM_GETIDEALSIZE

Gets the size needed to display the control without clipping. Send this message explicitly or by using the DateTime_GetIdealSize macro.

DTM_GETMCCOLOR

Gets the color for a given portion of the month calendar within a date and time picker (DTP) control. You can send this message explicitly or use the DateTime_GetMonthCalColor macro.

DTM_GETMCFONT

Gets the font that the date and time picker (DTP) control's child month calendar control is currently using. You can send this message explicitly or use the DateTime_GetMonthCalFont macro.

DTM_GETMCSTYLE

Gets the style of a DTP control. Send this message explicitly or by using the DateTime_GetMonthCalStyle macro.

DTM_GETMONTHCAL

Gets the handle to a date and time picker's (DTP) child month calendar control. You can send this message explicitly or use the DateTime_GetMonthCal macro.

DTM_GETRANGE

Gets the current minimum and maximum allowable system times for a date and time picker (DTP) control. You can send this message explicitly or use the DateTime_GetRange macro.

DTM_GETSYSTEMTIME

Gets the currently selected time from a date and time picker (DTP) control and places it in a specified SYSTEMTIME structure. You can send this message explicitly or use the DateTime_GetSystemtime macro.

DTM_SETFORMAT

Sets the display of a date and time picker (DTP) control based on a given format string. You can send this message explicitly or use the DateTime_SetFormat macro.

DTM_SETMCCOLOR

Sets the color for a given portion of the month calendar within a date and time picker (DTP) control. You can send this message explicitly or use the DateTime_SetMonthCalColor macro.

DTM_SETMCFONT

Sets the font to be used by the date and time picker (DTP) control's child month calendar control. You can send this message explicitly or use the DateTime_SetMonthCalFont macro.

DTM_SETMCSTYLE

Sets the style of a DTP control. Send this message explicitly or by using the DateTime_SetMonthCalStyle macro.

DTM_SETRANGE

Sets the minimum and maximum allowable system times for a date and time picker (DTP) control. You can send this message explicitly or use the DateTime_SetRange macro.

DTM_SETSYSTEMTIME

Sets the time in a date and time picker (DTP) control. You can send this message explicitly or use the DateTime_SetSystemtime macro.

 

Notifications

TopicContents
DTN_CLOSEUP

Sent by a date and time picker (DTP) control when the user closes the drop-down month calendar. The month calendar is closed when the user chooses a date from the month calendar or clicks the drop-down arrow while the calendar is open.

DTN_DATETIMECHANGE

Sent by a date and time picker (DTP) control whenever a change occurs. This notification code is sent in the form of a WM_NOTIFY message.

DTN_DROPDOWN

Sent by a date and time picker (DTP) control when the user activates the drop-down month calendar.

DTN_FORMAT

Sent by a date and time picker (DTP) control to request text to be displayed in a callback field. This notification code is sent in the form of a WM_NOTIFY message.

DTN_FORMATQUERY

Sent by a date and time picker (DTP) control to retrieve the maximum allowable size of the string that will be displayed in a callback field. This notification code is sent in the form of a WM_NOTIFY message.

DTN_USERSTRING

Sent by a date and time picker (DTP) control when a user finishes editing a string in the control. This notification code is only sent by DTP controls that are set to the DTS_APPCANPARSE style. This message is sent in the form of a WM_NOTIFY message.

DTN_WMKEYDOWN

Sent by a date and time picker (DTP) control when the user types in a callback field. This message is sent in the form of a WM_NOTIFY message.

NM_KILLFOCUS (date time)

Notifies a date and time picker control's parent window that the control has lost the input focus. NM_KILLFOCUS (date time) is sent in the form of a WM_NOTIFY message.

NM_SETFOCUS (date time)

Notifies a date and time picker control's parent window that the control has received the input focus. NM_SETFOCUS (date time) is sent in the form of a WM_NOTIFY message.

 

Structures

TopicContents
DATETIMEPICKERINFO

Contains information about a DTP control.

NMDATETIMECHANGE

Contains information about a change that has taken place in a date and time picker (DTP) control. This structure is used with the DTN_DATETIMECHANGE notification code.

NMDATETIMEFORMAT

Contains information about a portion of the format string that defines a callback field within a date and time picker (DTP) control. It carries the substring that defines the callback field and contains a buffer to receive the string that will be displayed in the callback field. This structure is used with the DTN_FORMAT notification code.

NMDATETIMEFORMATQUERY

Contains information about a date and time picker (DTP) control callback field. It contains a substring (taken from the control's format string) that defines a callback field. The structure receives the maximum allowable size of the text that will be displayed in the callback field. This structure is used with the DTN_FORMATQUERY notification code.

NMDATETIMESTRING

Contains information specific to an edit operation that has taken place in a date and time picker (DTP) control. This message is used with the DTN_USERSTRING notification code.

NMDATETIMEWMKEYDOWN

Carries information used to describe and handle a DTN_WMKEYDOWN notification code.

 

Constants

TopicContents
Date and Time Picker Control Styles

The window styles listed here are specific to date and time picker controls.

 

 

 

Show: