I am replacing an AutoHotkey script with a VB.net application. Part of the script involves sending keystrokes to an active application. VB uses SendInput and does send the keystrokes, but the application doesn't "get" them, but when AutoHotkey sends the same key to the same application, it works. I have verified that VB is indeed sending the keys properly. Does anyone know how to imitate the autohotkey Send function?
Xcelled194
28
Junior Poster in Training
Recommended Answers
Jump to PostXcelled194
It looks like the window your sending the key strokes to needs to be the active window.
I was able to use these additional functions to do that.
I created a seperate VS project named TestKeyInput. This code brings that window up and types Dim s …
Jump to PostI was able to get key strokes in notepad with the above code.
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim WINDOW_HANDLE As IntPtr = FindWindow(Nothing, "test - Notepad") Dim WINDOW_THREAD_ID As IntPtr = GetWindowThreadProcessId(WINDOW_HANDLE, IntPtr.Zero) If WINDOW_THREAD_ID = IntPtr.Zero Then Exit …
All 7 Replies
Unhnd_Exception
Xcelled194
28
Junior Poster in Training
Unhnd_Exception
Unhnd_Exception
Unhnd_Exception
Xcelled194
28
Junior Poster in Training
paulobuchsbaum
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.