If Not TH. WaitForEmpty JobQueue (15) = True Then'over 15S automatically clears all

TH. Cancel Execution

Else



End If

If the thread executes for a long time, is the main program hung up and waited for 15S to execute again? If so, it is equivalent to blocking mode, which will affect the mouse click interface response. I used to use the following methods, there is no difference between the two methods, thank you.



Dim tAddTickCount As Long, tTickCount As Long

TAddTickCount = 15

TTickCount = New_c.HPTimer



Do

New_c.SleepEx 10

DoEvents

If TH.WaitForEmpty JobQueue = True Then Exit Do

If New_c.HPTimer - tTickCount > tAddTickCount Then

TH. Cancel Execution

Endif

End If

Loop Until TH.JobQueueCount < 1