C语言如何实现一个正在循环运行的程序,当按下某个键时,运行另一个函数??

2024年11月27日 17:43
有1个网友回答
网友(1):

Private stopIt As Boolean

Private Sub Command1_Click()
Dim shuzhi As Double
Dim shuzhi1 As Double
Text1.Text = "正在运行"
For shuzhi = 1 To 60000
If stopIt Then Exit Sub
DoEvents
For shuzhi1 = 1 To 20000
Next shuzhi1
Next shuzhi
Text1.Text = "完成"
End Sub

Private Sub Command2_Click()
Text1.Text = "中断运行"
stopIt = True
End Sub