CMonthCalCtrl MCN_SELECT problem
-
Hello all, I created a Month calendar control into my form, and I want to use it as a date picker, so when the user selects a date, I will fill other CEdit controls with the date selected. But I realize that within MCN_SELECT, the value associated with my Calendar Control, gets the wrong date. void CPlanmView::OnSelectMonthcalendar1(NMHDR* pNMHDR, LRESULT* pResult) { // Users Selects a Date, so MCN_SELECT triggers this. // User selected October 31, 2003 but returns // Feb,10,2004 *pResult = 0; UpdateData(); m_DiaPlm.Format("%d",m_CalendarVal.GetDay()); m_MesPlm.Format("%d",m_CalendarVal.GetMonth()); m_AnoPlm.Format("%d",m_CalendarVal.GetYear()); UpdateData(FALSE); } I have also seen the sample provided in the msdn, and it has the same problem, for this control. Any Ideas on how to workaround this issue. Best, -Alfredo
-
Hello all, I created a Month calendar control into my form, and I want to use it as a date picker, so when the user selects a date, I will fill other CEdit controls with the date selected. But I realize that within MCN_SELECT, the value associated with my Calendar Control, gets the wrong date. void CPlanmView::OnSelectMonthcalendar1(NMHDR* pNMHDR, LRESULT* pResult) { // Users Selects a Date, so MCN_SELECT triggers this. // User selected October 31, 2003 but returns // Feb,10,2004 *pResult = 0; UpdateData(); m_DiaPlm.Format("%d",m_CalendarVal.GetDay()); m_MesPlm.Format("%d",m_CalendarVal.GetMonth()); m_AnoPlm.Format("%d",m_CalendarVal.GetYear()); UpdateData(FALSE); } I have also seen the sample provided in the msdn, and it has the same problem, for this control. Any Ideas on how to workaround this issue. Best, -Alfredo
-
Carlos, Thanks for your reply, well I just created it with no code. I mean I put it on my form dragging the control. But I just saw that msdn sample and here is the code, still doesn't work in that way. BOOL CMonthCalPage::OnInitDialog() { CPropertyPage::OnInitDialog(); CWnd *pFrame = GetDlgItem(IDC_MCFRAME); CRect rcWnd; pFrame->GetClientRect(rcWnd); pFrame->DestroyWindow(); //pFrame was just a placeholder anyway. m_MonthCal.Create(WS_CHILD|WS_VISIBLE,CPoint(rcWnd.left,rcWnd.top),this,IDC_MONTHCAL); UpdateData(FALSE); return TRUE; } Thanks for helping Alfredo Best, Alfredo