I'm trying to find out if a recurring task occurs on a particular date. I'm
able to the get the IRecurrencePattern of the task but here is where I'm
having trouble. Whenever I pass a date to the GetOccurence() method of the
IRecurrencePattern I always get false no matter how many dates I pass to it.
My code for testing the occurences is below. I'm trying to mimic the
behavior of the tasks today screen plugin that comes with the Pocket PC.

Any Ideas?

Thanks in advance,
ed

int m_range = //the number of days that I'm going to test
for(i = 0; i < m_range; i++)
{
IAppointment* pAppt2;
SYSTEMTIME st;
COleDateTime temp_date(cur_yr, cur_mo, cur_date + i, 0,0,0);
DATE st_date;

temp_date.GetAsSystemTime(st);
SystemTimeToVariantTime(&st, &st_date);

if(SUCCEEDED(pRec->GetOccurrence(st_date, &pAppt2)))
{
pRec->Release();
pAppt2->Release();
return TRUE;
}
}

return FALSE;

Re: ITask and IRecurrencePattern by Peter

Peter
Mon Apr 04 15:23:14 CDT 2005

Prior to Windows Mobile 2003 you must call GetOccurrence with the full date
and time of the occurrence. From WM2003 onwards you can pass just the date.

Peter

--
Peter Foot
Windows Embedded MVP
http://www.inthehand.com | http://blog.opennetcf.org/pfoot/

"ed" <ed@discussions.microsoft.com> wrote in message
news:9408A28B-BEE8-4813-9070-3C24BEDFB126@microsoft.com...
> I'm trying to find out if a recurring task occurs on a particular date.
> I'm
> able to the get the IRecurrencePattern of the task but here is where I'm
> having trouble. Whenever I pass a date to the GetOccurence() method of
> the
> IRecurrencePattern I always get false no matter how many dates I pass to
> it.
> My code for testing the occurences is below. I'm trying to mimic the
> behavior of the tasks today screen plugin that comes with the Pocket PC.
>
> Any Ideas?
>
> Thanks in advance,
> ed
>
> int m_range = //the number of days that I'm going to test
> for(i = 0; i < m_range; i++)
> {
> IAppointment* pAppt2;
> SYSTEMTIME st;
> COleDateTime temp_date(cur_yr, cur_mo, cur_date + i, 0,0,0);
> DATE st_date;
>
> temp_date.GetAsSystemTime(st);
> SystemTimeToVariantTime(&st, &st_date);
>
> if(SUCCEEDED(pRec->GetOccurrence(st_date, &pAppt2)))
> {
> pRec->Release();
> pAppt2->Release();
> return TRUE;
> }
> }
>
> return FALSE;