16,554
社区成员
发帖
与我相关
我的任务
分享
Private iStep As Integer
Sub Button1Click()
处理
Button1.Enabled = False
num1 = GetTickCount
iStep = 1
ti1.AutoReset = True
ti1.Interval = 1000
ti1.Enable = True
End Sub
Sub Button2Click()
处理
Button2.Enabled = False
num1 = GetTickCount
iStep = 2
End Sub
Sub Button2Click()
处理
Button3.Enabled = False
num1 = GetTickCount
iStep = 3
End Sub
Sub ti1_Elapsed()
If iStep = 0 Then
Exit Sub
End If
If Interlocked.Exchange(isbusy1, 1) = 0 Then
num2 = GetTickCount
If num2 - num1 > 10000 Then
Select Case iStep
Case 1
处理1
Button2.Enabled = True
Case 2
处理2
Button3.Enabled = True
Case 3
处理3
Button1.Enabled = True
End Select
iStep = 0
End If
Interlocked.Exchange(isbusy1,0)
End If
End Sub
Private Sub tm_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles tm.Elapsed
Static isBusy As Boolean = False
If isBusy Then Exit Sub
isBusy = True
长时间的处理()
isBusy = False
End Sub
Private Sub tm_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles tm.Elapsed
Static isBusy As Boolean = False
Static iStep As Integer = 0
If isBusy Then Exit Sub
isBusy = True
Select Case iStep
Case 0
步骤1()
Case 1
步骤2()
Case 2
步骤3()
End Select
iStep = (iStep + 1) Mod 3
isBusy = False
End Sub