class CDateTimeDlg : public CDialog
{
// Construction
public:
CDateTimeDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CDateTimeDlg)
enum { IDD = IDD_DATETIME_DIALOG };
COleDateTime m_Date1;
..
//}}AFX_DATA
..
// Generated message map functions
//{{AFX_MSG(CDateTimeDlg)
virtual BOOL OnInitDialog();
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnDatetimechangeDatetimepicker1(NMHDR* pNMHDR, LRESULT* pResult);
..
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
void CDateTimeDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDateTimeDlg)
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER1, m_Date1);
..
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDateTimeDlg, CDialog)
//{{AFX_MSG_MAP(CDateTimeDlg)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_NOTIFY(DTN_DATETIMECHANGE, IDC_DATETIMEPICKER1, OnDatetimechangeDatetimepicker1)
..
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
..
void CDateTimeDlg::OnDatetimechangeDatetimepicker1(NMHDR* pNMHDR, LRESULT* pResult)
{
UpdateData(TRUE);
.. m_Date1.Format(_T("%A, %B %d, %Y")) ..
*pResult = 0;
}