Evaluates an expression after a specified number of milliseconds has elapsed.
Syntax
HRESULT setTimeout(
VARIANT *expression,
long msec,
VARIANT *language,
long *timerID
);
Parameters
- expression
-
[in] Pointer to a VARIANT that specifies the function pointer or string that indicates the code to be executed when the specified interval has elapsed.
- msec
-
[in] long that specifies the number of milliseconds.
- language
-
[in] BSTR that specifies one of the following values:
JScript- Language is JScript.
VBScript- Language is VBScript.
JavaScript- Language is JavaScript.
- timerID
-
Integer. Returns an identifier that cancels the evaluation with the IHTMLWindow2::clearTimeout method.
Return Value
Returns S_OK if successful, or an error value otherwise.
Remarks
In versions earlier than Microsoft Internet Explorer 5, the first argument of IHTMLWindow2::setTimeout must be a string. Evaluation of the string is deferred until the specified interval elapses.
As of Internet Explorer 5, the first argument of IHTMLWindow2::setTimeout can be a string or a function pointer.
The specified expression or function is evaluated once. For repeated evaluation, use the IHTMLWindow2::setInterval or IHTMLWindow3::setInterval method.
See Also
IHTMLWindow2::clearTimeout