Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
关于异步执行,大概代码如下,我想点按钮终止异步执行,好像不起作用。麻烦指导一下。
Public Total As Integer
public pauseflag as boolean首先增加一个名为"AddTotal"的函数,代码为:
if pauseflag = false then return nothing
For i As Integer = 1 To 100
Total = Total + 1
Next
然后在命令窗口用AsyncExecute方法异步执行此函数100次:
Total = 0
pauseflag = true
For i As Integer = 1 To 100
Functions.AsyncExecute("AddTotal")
Next
Sleep (2000) '等待2秒,待所有子线程线程执行完毕
Return Total
然后我在其他的地方设置一个按钮,点按钮时执行:pauseflag = false