如何用IActiveScriptSiteInterruptPoll结束脚本的执行。

caslwzgks 2005-05-10 05:35:34
对于脚本宿主(ActiveHost)来说如果脚本内有长时间执行的任务或死循环或脚本调用的外部组件内有死循环,ActiveHost可以通过实现IActiveScriptSiteInterruptPoll接口重载QueryContinue访法来中断执行,如QueryContinue让返回S_FALSE。但是如何让它起作用呢?
...全文
84 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
kingzai 2005-05-13
  • 打赏
  • 举报
回复
How do i stop a script within the script?
Never had to do this, but I dug some info up for you.

There is IActiveScriptSiteInterruptPoll, with the single method QueryContinue(). Both the VBScript and JScript engines query for it, and when you return S_FALSE from QueryContinue(), the script stops executing.

So say you wanted to run a script within a user interface. While the script is running, you display a "please wait" dialog box with a "stop" button on it. When the user presses the button, set your m_bQuit flag to TRUE, and then implement QueryContinue like this.


STDMETHOD(QueryContinue)()
{
// ... pump any windows messages so the stop button can be pressed

if (m_bQuit)
return S_FALSE;
return S_OK;
}

or you could just set a flag and bypass remaing code if flag is set
here is vbscript language reference.
http://msdn.microsoft.com/library/default....oriVBScript.asp
caslwzgks 2005-05-13
  • 打赏
  • 举报
回复
我分怎么给呀:(
xiaolivc 2005-05-11
  • 打赏
  • 举报
回复
很好的文章呀
可以来这个群里一起讨论吗 8051231


关于 vc 学习与交流的群
caslwzgks 2005-05-11
  • 打赏
  • 举报
回复
看来没有人知道:(
caslwzgks 2005-05-10
  • 打赏
  • 举报
回复
其它的也行只要能达到目的就行。
jerry 2005-05-10
  • 打赏
  • 举报
回复
这个接口 没听说过呀?

3,245

社区成员

发帖
与我相关
我的任务
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
  • ATL/ActiveX/COM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧