DoEvents()什莫意思?

stanely 2000-08-08 07:41:00
各位大侠不是只否能告诉我DoEvents()干什莫用?
最好是有程序代码的例子,
小弟将感激不尽!以我仅有的10分奉上!
...全文
157 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
stanely 2000-08-09
  • 打赏
  • 举报
回复
thanks!
xiaohuilau 2000-08-08
  • 打赏
  • 举报
回复
DoEvents 是令程序在忙于执行指令时抽出少许时间让给别的程序。最实用就是若你编了一个死循环的程序,若在循环体中加了 DoEvents 就有时间跳出死循环。如:
dim i,j
for i=1 to 10000
j=j+1
doEvents
next i
这样你试下在程序执行时去运行别的程序。再去掉DoEnents去拟行别的程序就一目了然了。
forise 2000-08-08
  • 打赏
  • 举报
回复
This example uses the DoEvents function to cause execution to yield to the operating system once every 1000 iterations of the loop. DoEvents returns the number of open Visual Basic forms, but only when the host application is Visual Basic.

' Create a variable to hold number of Visual Basic forms loaded
' and visible.
Dim I, OpenForms
For I = 1 To 150000 ' Start loop.
If I Mod 1000 = 0 Then ' If loop has repeated 1000 times.
OpenForms = DoEvents ' Yield to operating system.
End If
Next I ' Increment loop counter.

7,762

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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