Schedules single or periodic notifications.
Syntax
HRESULT Advise( VARIANT vtimeMin, VARIANT vtimeMax, VARIANT vtimeInterval, DWORD dwFlags, ITimerSink *pTimerSink, DWORD *pdwCookie );
Parameters
- vtimeMin
- [in] VARIANT that contains the earliest time that the notification can occur.
- vtimeMax
- [in] VARIANT that contains the latest time that the notification can occur. This should be zero if the timer has no expiration.
- vtimeInterval
- [in] VARIANT that contains the desired interval between notifications. This should be zero for a single (nonperiodic) callback.
- dwFlags
- Reserved for future use.
- pTimerSink
- [in] Address of the ITimerSink object to receive the events.
- pdwCookie
- [out] LPDWORD address to receive a cookie identifying the event request.
Return Value
Returns one of the following values:
S_OK The method was called successfully. E_INVALIDARG vtimeMax is less than vtimeMin, or the current time is greater than vtimeMax. E_POINTER A pointer is invalid. E_OUTOFMEMORY The system is out of memory.
Remarks
Setting vtimeMax to zero means that the timer will not expire; it must be explicitly stopped by calling ITimer::Unadvise. Setting vtimeInterval to zero indicates that once a notification is sent, the notification is automatically removed.
The ITimer::Advise method may be used to simulate the DHTML methods setTimeout and setInterval. For example, setTimeout generates a single callback after the number of milliseconds specified. To accomplish this with ITimer::Advise, call the method with the following parameters:
To simulate setInterval, which generates recurring callbacks after the specified number of milliseconds, call ITimer::Advise with:
- vtimeMin = timeCurrent + number of milliseconds until the timer should timeout.
- vtimeMax = 0
- vtimeInterval = 0
- vtimeMin = timeCurrent + number of milliseconds until the timer should timeout.
- vtimeMax = 0
- vtimeInterval = number of milliseconds until the timer should timeout.