Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15136

Help control from the keyboard

$
0
0
hi
How can I control from the keyboard letter pressing a specific place on the screen like mouse Cursor.Position
Code:

    Private Const KEYEVENTF_KEYDOWN As Integer = &H0
    Private Const KEYEVENTF_KEYUP As Integer = &H2

    <DllImport("user32.dll", EntryPoint:="keybd_event")>
    Private Shared Sub keybd_event(ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As UInteger, ByVal dwExtraInfo As UInteger)
    End Sub

    Private Sub Timer3_Tick(sender As Object, e As EventArgs) Handles Timer3.Tick
        Cursor.Position = New Point(1006, 360)
        keybd_event(CByte(Keys.D), 0, KEYEVENTF_KEYDOWN, 0)
        keybd_event(CByte(Keys.D), 0, KEYEVENTF_KEYUP, 0)
    End Sub

I tried to use this code, but the mouse pointer is moving and the button is not pressed within this specific space, the letter D

Viewing all articles
Browse latest Browse all 15136

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>