void CCalendarDemoDlg::OnSelchangeCalendar(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
//获取控件当前所选日期
SYSTEMTIME st={0};
m_calendar.GetCurSel(&st);
st.wHour=st.wMinute=st.wSecond=st.wMilliseconds=0;
CTime timeBegin(st.wYear,1,1,0,0,0);
//得当前所选日期和改年1月1日的差值
CTime timeSel(st);
CTimeSpan ts=timeSel - timeBegin;
//根据差值得到日期数
TCHAR szOutput[128]={0};
_stprintf(szOutput,_T("%d年%d月%d日是%d年的第%d天."),timeSel.GetYear(),timeSel.GetMonth(),
timeSel.GetDay(),timeSel.GetYear(),ts.GetDays()+1);
//输出结果
SetDlgItemText(IDC_OUTPUT,szOutput);
*pResult = 0;
}
--Configuration: CalendarDemo - Win32 Debug--------------------
Compiling...
CalendarDemoDlg.cpp
D:/install sofeware/MSDev98/MyProjects/CalendarDemo/CalendarDemoDlg.cpp(178) : error C2039: 'GetCurSel' : is not a member of 'CTime'
d:/vc98/mfc/include/afx.h(1532) : see declaration of 'CTime'
Error executing cl.exe.
CalendarDemo.exe - 1 error(s), 0 warning(s)