質問

I can't figure out how to make system to wait 10 secounds without make him to sleep (I want to make only timer2 to wait 10 seconds and after it, to start work. I tried System.Threading.Thread.Sleep(10000) but this code make all app to sleap. Here is the code from timer2

Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
    '1214x727
    Dim procinstall As Boolean = Process.GetProcesses().Any(Function(p) p.ProcessName.Contains("ErrorFixer"))
    If procinstall = True Then
        SetCursorPos(1214, 727)
        mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0) 'Invoke mouse down event
        mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0) 'Invoke mouse up event
        mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0) 'Invoke mouse down event
        mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0) 'Invoke mouse up event
        Timer2.Stop()
        Label3.Text = "Installing"
    End If
End Sub

After If procinstall = True Then, I want to put that code to wait until cursor will go to that position and mouse will click.

Thanks.

役に立ちましたか?

解決

Set the Timer's interval to 10000. Handle Elapsed event (for Timers.Timer).

EDIT: If you are using a Timer control on a form, the event is called Tick.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top