Hello,
I have two CDateTimeCtrls on a CFormView based app using .net. I
use one for the date and one for the time. I want to use the date
and time from them to search files and compare the files date/time
with <, == and > using CTime structs. I don't always use the time
so I have a check box in that control (DTS_SHOWNONE flag). The
problem I am having is in ignoring the time. Apparently, the
members of CTime can only be set when the object is created. So I
tried forcing the time to a max value but it gets replaced when the
date control is read.
In view I have the code to get the date/time and in FindFiles I
have the code to compare the CTime structs. I realize I could test
individual members of the CTime structs in FindFiles but I was
trying to do it with the built-in compare functions. The problem
seems to be that I can't manually set members in CTime. Is there a
way around this or am I following the wrong path?
void CMyView::Start()
{
CTime tmpTime(80,12,31,23,59,59,-1);
m_date.GetTime(tmpTime);
if (m_time.GetTime(tmpTime) != GDT_NONE)
sd.cTime = tmpTime;
else
m_date.GetTime(sd.cTime);
//at this point sd.cTime should contain a valid date and possibly
//a valid time
}
bool FindFiles::FileHasChanged(const string & locn, SearchData & sd)
{
CFile cFile;
CFileStatus statusSrc;
cFile.GetStatus(locn.c_str(), statusSrc);
switch (sd.searchtype)
{
case CMP_BEFORE:
if (sd.cTime - statusSrc.m_ctime > 0)
return true;
break;
//...other cases here
}
return false;
}
--
Jack
Email: [EMAIL PROTECTED]
Home: http://home.twmi.rr.com/jyorktw/
...Virginity like bubble, one prick, all gone.
