• Announcements

Archived

This topic is now archived and is closed to further replies.

MFC MonthCal problems

Recommended Posts

All I''m looking for is reading the date outta a MonthCalendar (I''m using the one provided in the tool bar in Visual C++ 6.0). If I have the value variable set (through the class wizard) to COleDateTime type, I get normal behavior out of the calendar itself. But if I attempt to read any date after I change it to something other than the current it returns invalid values. If I use type CTime instead I can read the values, and correctly, but If I call an UpdateData() followed by UpdateData(false) the calendar itself jumps forward a few months a few days and a few years as if UpdateData did this.... Any ideas? Pat - Ex nihilo nihilus

Share on other sites
In fact, the year increase exponentially.... The increase amount goes like so: 3 5 8 11 13 16.....

I really wish the provided controls would have been tested.... Even as much as using it once would show this problem up.

Pat - Ex nihilo nihilus

[edited by - patindahat on August 14, 2003 10:47:10 PM]

Share on other sites
If you create a COleDateTime object with a date less than 100, the date will be accepted, but subsequent calls to GetYear, GetMonth, GetDay, GetHour, GetMinute, and GetSecond will fail and return -1. Previously, you could use two-digit dates, but dates must be 100 or greater in MFC 4.2 and later.

Thats straight from MSDN.... So my best guess is that UpdateData is setting the date to less than 100, not sure why that''d happen though.

Pat - Ex nihilo nihilus

Share on other sites
I got it to work, although its rather messy and defenatly makes the computer work more that it should. I don''t understand why I can''t access the date directly through the COleDateTime Object, but I used that one, and use the macro at the beginning of this code to read the info

//Get the selected dateHWND Cal;GetDlgItem(IDC_CALENDAR, &Cal);SYSTEMTIME Time;MonthCal_GetCurSel(Cal , &Time);UpdateData();m_DeadLineDay = Time.wDay;m_DeadLineMonth = Time.wMonth;m_DeadLineYear = Time.wYear;UpdateData(false);

Pat - Ex nihilo nihilus

• Forum Statistics

• Total Topics
627759
• Total Posts
2978958

• 11
• 10
• 10
• 23
• 14