Microsoft Windows CE 3.0  

CBaseReferenceClock::AdvisePeriodic

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Sets up a recurring advise with the reference clock.

HRESULT AdvisePeriodic(
REFERENCE_TIME
StartTime
,
REFERENCE_TIME
PeriodTime
,
HSEMAPHORE
hSemaphore
,
DWORD *
pdwAdviseToken
);

Parameters

StartTime
Start at this time.
PeriodTime
Time between notifications.
hSemaphore
Advise through a semaphore.
pdwAdviseToken
Advise token that identifies the link with the clock.

Return Values

Returns one of the following HRESULTvalues:

E_OUTOFMEMORY  
E_INVALIDARG  
NOERROR No error.

Remarks

A semaphore is used, rather than an event, to ensure that multiple notifications can be seen by the user. Each time an amount of time specified in the PeriodTimeparameter elapses, the semaphore will be released.

When no further notifications are required, call CBaseReferenceClock::Unadviseand pass the pdwAdviseTokenvalue returned from this call.

For example, the following code extract sets up an advise link that fires its first advise five seconds from now and then signals every second until Unadviseis called. By using a semaphore with a count of 10, the clock is effectively able to cache 10 events.

HANDLE hSemaphore = CreateSemaphore(NULL, 0, 10,
NULL); // Assume pRefClock is an IReferenceClock* variable.
REFERENCE_TIME rtPeriodTime = 1000 * (UNITS / MILLISECONDS); // A
one-second interval REFERENCE_TIME rtNow; DWORD dwAdviseToken;
pRefClock->GetTime(&rtNow);
pRefClock->AdvisePeriodic(rtNow+(5*rtPeriodTime), PeriodTime,
hSemaphore, &dwAdviseToken);