When I'm using SendKeys.Send() for F5 or something like that it just freezes the focused window. Here is the a excerpt of my code.
Code:
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If m.Msg = WM_HOTKEY Then
Dim id As IntPtr = m.WParam
Select Case (id.ToString)
Case "1"
Me.Cursor = New Cursor(Cursor.Current.Handle)
Cursor.Position = New Point(0, 0) 'I have no idea why I put this lol
Cursor.Position = New Point(248, 509)
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
Sleep(3000)
Cursor.Position = New Point(460, 514)
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
Sleep(11000)
SendKeys.Send("{F5}")
Sleep(11000)
Cursor.Position = New Point(666, 514)
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
Sleep(3000)
Cursor.Position = New Point(949, 729)
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
Sleep(3000)
Please Help!
(I rather not use SendKeys because it is very buggy for anything so far but couldn't get anything else...)
P.S. How can I exit a While statement anytime in the While statement. Like I'm running the above code (well the above code and a little more) in a While M=1 and while in the While statement the variable changes so its not equal one, how can I make is so it immediately jumps out of the While statement.