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:
|SCRIPTTHREADID_ALL||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.|
|SCRIPTTHREADID_BASE||The base thread; that is, the thread in which the scripting engine was instantiated.|
|SCRIPTTHREADID_CURRENT||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:
|SCRIPTINTERRUPT_DEBUG||If supported, enter the scripting engine's debugger at the current script execution point.|
|SCRIPTINTERRUPT_RAISEEXCEPTION||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).|