怎样用SDK读写Date Time Picker控件?用什么函数?

解决方案 »

  1.   

    难道是用:SetDlgItemText,GetDlgItemText吗?
      

  2.   

    要学会查MSDN:
    Date and Time Picker Control Reference--------------------------------------------------------------------------------This section contains information about the API elements used with date and time picker controls.
    Overviews
    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.Macros
    DateTime_GetMonthCal
    Retrieves 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
    Retrieves 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
    Retrieves 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_GetRange
    Retrieves 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
    Retrieves 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_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
    DTM_GETMCCOLOR
    Retrieves 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
    Retrieves 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_GETMONTHCAL
    Retrieves 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
    Retrieves 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
    Retrieves 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_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
    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 message 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 message 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 message 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 message 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
    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 message. 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 message. 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 message. 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 message. NMDATETIMEWMKEYDOWN
    Carries information used to describe and handle a DTN_WMKEYDOWN notification message. Constants
    Date and Time Picker Control Styles
    The window styles listed here are specific to date and time picker controls.--------------------------------------------------------------------------------© 2003 Microsoft Corporation. All rights reserved.
      

  3.   

    GetDlgItemText 函数获得是char[],怎么转换成时间,比如获取年月日或毫秒数呢?难道是通过字符操作函数吗?有没有现有的函数来完成?
      

  4.   

    Mackz(在相互):非常感谢,你说的很对,要学会查MSDN。我也查了,可能方法不对。刚才我用Date and Time Picker搜索查出来了。以前我是在sdk的文档里找,只找到了Dialog Box Functions。能介绍一下你查msdn的方法吗?