class CDateTimeDlg : public CDialog
{
// Construction
public:
CDateTimeDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CDateTimeDlg)
enum { IDD = IDD_DATETIME_DIALOG };
..
COleDateTime m_Date3;
//}}AFX_DATA
..
// Generated message map functions
//{{AFX_MSG(CDateTimeDlg)
virtual BOOL OnInitDialog();
..
afx_msg void OnSelchangeMonthcalendar1(NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
void CDateTimeDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDateTimeDlg)
..
if (pDX->m_bSaveAndValidate == 0)
DDX_MonthCalCtrl(pDX, IDC_MONTHCALENDAR1, m_Date3);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDateTimeDlg, CDialog)
//{{AFX_MSG_MAP(CDateTimeDlg)
ON_WM_PAINT()
..
ON_NOTIFY(MCN_SELCHANGE, IDC_MONTHCALENDAR1, OnSelchangeMonthcalendar1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
..
void CDateTimeDlg::OnSelchangeMonthcalendar1(NMHDR* pNMHDR, LRESULT* pResult)
{
CMonthCalCtrl* pCal = (CMonthCalCtrl*) GetDlgItem(IDC_MONTHCALENDAR1);
SYSTEMTIME stSystemTime;
// UpdateData(TRUE);
pCal->GetCurSel(&stSystemTime);
m_Date3.SetDate(stSystemTime.wYear, stSystemTime.wMonth, stSystemTime.wDay);
.. m_Date3.Format(VAR_DATEVALUEONLY) ..
*pResult = 0;
}