Bug in CMonthCalCtrl class ??
-
Hello, I was trying to create a dialog containing a calendar, so I decided to use the Month Calendar proposed by VC++ in the control bar. But during the execution, when I click the calendar and display the selected day, I remarked that the day was wrong, 12 days more than the day I effectively clicked ... I search in the MSDN CD to find an example and install the CmnCtrl1 project. The MSDN project calendar reacts in the same way, 12 days more as soon as you click on another day that the current day. Do I miss something in the use of this control ? Is it bugged ? If yes, is there a solution/workaround ? Can I use it with Win2K ? Thanks in advance DD PS : I use Visual Studio 6.0 with Win2K
-
Hello, I was trying to create a dialog containing a calendar, so I decided to use the Month Calendar proposed by VC++ in the control bar. But during the execution, when I click the calendar and display the selected day, I remarked that the day was wrong, 12 days more than the day I effectively clicked ... I search in the MSDN CD to find an example and install the CmnCtrl1 project. The MSDN project calendar reacts in the same way, 12 days more as soon as you click on another day that the current day. Do I miss something in the use of this control ? Is it bugged ? If yes, is there a solution/workaround ? Can I use it with Win2K ? Thanks in advance DD PS : I use Visual Studio 6.0 with Win2K
In fact, I found the solution on another forum. Here is the wrong code proposed by microsoft : CString pDate; CTime ct; if( m_MonthCal_1.GetCurSel(ct) ) { pDate.Format(_T("%02d/%02d/%2d"),ct.GetMonth(),ct.GetDay(),ct.GetYear()); AfxMessageBox(pDate); // just for testing } Here is the right code : CString pDate; SYSTEMTIME ct; if( m_MonthCal_1.GetCurSel(&ct) ) { pDate.Format(_T("%02d/%02d/%2d"),ct.wMonth ,ct.wDay, ct.wYear ); AfxMessageBox(pDate); // just for testing } The correct way is to use a SYSTEMTIME instead of a CTime type ... DD