|Microsoft Windows Script Interfaces|
Interrupts the execution of a running script thread (an event sink, an immediate execution, or a macro invocation). This method can be used to terminate a script that is stuck (for example, in an infinite loop). It can be called from non-base threads without resulting in a non-base callout to host objects or to the IActiveScriptSite method.
HRESULT InterruptScriptThread( SCRIPTTHREADID stidThread, // identifier of thread const EXCEPINFO *pexcepinfo, // receives error information DWORD dwFlags );
[in] Identifier of the thread to interrupt, or one of the following special thread identifier values:
All threads. The interrupt is applied to all script methods currently in progress. Note that unless the caller has requested that the script be disconnected, the next scripted event causes script code to run again by calling the IActiveScript::SetScriptState method with the SCRIPTSTATE_DISCONNECTED or SCRIPTSTATE_INITIALIZED flag set.
The base thread; that is, the thread in which the scripting engine was instantiated.
The currently executing thread.
[in] Address of an EXCEPINFO structure containing the error information that should be reported to the aborted script.
[in] Option flags associated with the interruption. Can be one of these values:
If supported, enter the scripting engine's debugger at the current script execution point.
If supported by the scripting engine's language, let the script handle the exception. Otherwise, the script method is aborted and the error code is returned to the caller; that is, the event source or macro invoker.
Returns one of the following values:
An argument was invalid.
An invalid pointer was specified.
The call was not expected (for example, the scripting engine has not yet been loaded or initialized).