Visual Basic 2008 SendKeys.Send() Help

Posts 1–2 of 2 · Page 1 of 1
Visual Basic 2008 SendKeys.Send() Help
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.
Most Easy way:

My.Computer.Keyboard.sendkeys("A", true)

Lol.... To find Key Codes Type in Google
VB KeyCodes it'll be the first or second link

If Your Detecting a Hotkey then:

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs)
Handles form1.KeyDown

Handles TextBox2.KeyDown
If e.KeyCode = Keys.F2 Then
end sub
Posts 1–2 of 2 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

Talk with us