Click to See Complete Forum and Search --> : Date Time Picker Problem
TraderBoy
September 10th, 1999, 02:27 PM
I used a Date Time Picker control & mapped value to CTime. The default value in the control when I run the app is 12/31/69. Works fine until I change the date in the control. Then get ASSERT failure. I traced the code after returning from DoModal(). MFC calls DoDataExchange() which calls DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER, m_tDate); (m_tDate is dialog variable of type CTime. Assert fails when CTime constructor in MFC's file TimeCore.cpp is called at Line 40 . . . ASSERT(m_time != -1);. Any ideas. Thanks very much for anyone's input.
PS. I just learned that it fails only when I change the month or day. I can change the year without the assert failure. (?)
Anthony Mai
September 10th, 1999, 03:38 PM
CTime is defined only between the first strike of new year of 1970 and the time bomb explodes on Jan. 18, 2038. I would avoid using CTime in my program.
When your control is initialized to Dec. 31, 1969, any slight change to the month or day yields a date value that's beyond the valid definition range of CTime. I would be surprised if that didn't cause problem.
Don't use MFC's DDX. Do your own. And use COleDateTime instead.
I hate fat programs as much as I hate being fat myself. I am lean and mean and so is my program.
TraderBoy
September 11th, 1999, 10:44 AM
Anthony,
Thanks! You were right. Any date in 1969 is invalid & the assert failure is triggered. Will experiment with the COleDateTime class. I haven't used any Ole controls. Thanks again for your quick reply.
Trader
TraderBoy
September 11th, 1999, 10:54 AM
One more question. When you say, "Don't use MFC's DDX. Do your own." . . . do you still call the applicable DDX??? function from within the DoDateExchange function wrote by the AppWizard? Do I just call it outside of the /{{AFX_DATA_MAP labels? Thanks again.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.