Option Explicit
Dim bExit As Boolean
Private Sub Command1_Click()
Do While Not bExit
Command1.Caption = Time
DoEvents
Loop
End SubPrivate Sub Command2_Click()
Do While Not bExit
Command2.Caption = Time
DoEvents
Loop
End SubPrivate Sub Form_Unload(Cancel As Integer)
bExit = True
End Sub每次点击command1时,command2就停,vb功能真弱
Dim bExit As Boolean
Private Sub Command1_Click()
Do While Not bExit
Command1.Caption = Time
DoEvents
Loop
End SubPrivate Sub Command2_Click()
Do While Not bExit
Command2.Caption = Time
DoEvents
Loop
End SubPrivate Sub Form_Unload(Cancel As Integer)
bExit = True
End Sub每次点击command1时,command2就停,vb功能真弱
这是死循环.
你这个功能用两个Timer控件可以实现.
或者用多线程.
再说线程,我单位里vb部门的就是在vb中用多显程,没遇到过什么不能就觉得问题呀。
下次说xx不好之前现想想自己真的理解它么?(主意是理解,不是了解)
你这个问题用Timer控件就很容易解决了!这用VB是很容易就能解决的问题,你怎么能说VB弱呢?
Option Explicit
Dim bExit As Boolean
dim com1ok as boolean
dim com2ok as boolean
Private Sub Command1_Click()
if com1ok=false then
com1ok=true
else
com1ok=false
end if
Do While Not bExit
if com1ok then Command1.Caption = Time
if com2ok then command2.caption=time
DoEvents
Loop
End SubPrivate Sub Command2_Click()
if com2ok=false then
com2ok=true
else
com2ok=false
end if
Do While Not bExit
if com1ok then Command1.Caption = Time
if com2ok then command2.caption=time
DoEvents
Loop
End SubPrivate Sub Form_Unload(Cancel As Integer)
bExit = True
End Sub实现功能,点击某一个command,那一个便开始显示时间,两个都点击,两个都显示;某一个再次点击,显示停止。如何?这是你想要的吧,给分呀。
其实解决这个问题的方案很多很多,VB真强大。
是你技术不行,楼主,抱歉
还是谢谢大家!
mvp lihonggen0请注意:
我是需要同时从视频卡采集多路视频图像到vga,通过loop我能在第一时间知道视频帧采集完毕(每分钟30帧)并处理(用Timer明显有丢帧现象),单个loop好像处理不过来,所以想通过多个loop,请教有何高见?
顺便说句,我用vb实现的loop循环采集数据cpu竟然占用80%,同样的实现vc才5%不到,高人指点?
http://www.applevb.com/art/timing.htm
利用里面提到的多媒体计时器。但是你需要确保你的一个执行要可以在10ms以内完成。BTW:在做类似视频采集这方面的程序时,VB不是强项,建议选择VC。
这个人好象我刚才在哪见过?
哦!就是漏了个数组的那人吧?
你的demo运行完1分钟后非法?
无法看到到底哪个准啊?