Advise method
Schedules single or periodic notifications.
Syntax
HRESULT retVal = object.Advise(vtimeMin, vtimeMax, vtimeInterval, dwFlags, pTimerSink, pdwCookie);
Parameters
- vtimeMin [in]
-
Type: VARIANT
A VARIANT of type DWORD that specifies the earliest time that the notification can occur.
- vtimeMax [in]
-
Type: VARIANT
A VARIANT of type DWORD that specifies the latest time that the notification can occur. This should be zero if the timer has no expiration.
- vtimeInterval [in]
-
Type: VARIANT
A VARIANT of type DWORD that specifies the desired interval between notifications. This should be zero for a single (nonperiodic) callback.
- dwFlags [in]
-
Type: DWORD
Reserved. Must be set to 0.
- pTimerSink [in]
-
Type: ITimerSink
A pointer to the ITimerSink interface to receive the events.
- pdwCookie [out]
-
Type: DWORD
A pointer to a DWORD address to receive a cookie identifying the event request.
Remarks
By setting vtimeMax to zero, the timer will not expire; it must be explicitly stopped by calling ITimer::Unadvise. By setting vtimeInterval to zero, after a notification is sent, the notification is automatically removed.
The ITimer::Advise method can be used to simulate two Dynamic HTML (DHTML) methods: IHTMLWindow2::setTimeout and IHTMLWindow2::setInterval. For example, IHTMLWindow2::setTimeout generates a single callback after the number of milliseconds specified. To accomplish this with ITimer::Advise, call the method with the following parameters.
- vtimeMin = timeCurrent + number of milliseconds until the timer times out.
- vtimeMax = 0
- vtimeInterval = 0
To simulate IHTMLWindow2::setInterval, which generates recurring callbacks after the specified number of milliseconds, call ITimer::Advise with the following parameters.
- vtimeMin = timeCurrent + number of milliseconds until the timer times out.
- vtimeMax = 0
- vtimeInterval = number of milliseconds until the timer times out.