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

2024-11-27 17:43:04
推荐回答(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