EDIT: I completey rewrote the thread since I go ta solution but another problem.
I delcare:
Then in my button.
That works really great, the problem is, when I switch the Keys.F5 to something like Keys.A, it doesn't press a at all (I guess because Notepad is not focused,
but I tried eve nwith it's focused on the text editor there, still nothing happens. No A.
I delcare:
Code:
Private Declare Function PostMessage Lib "user32.dll" Alias "PostMessageA" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As IntPtr) As IntPtr
Private Const WM_KEYDOWN As Long = &H100
Private Const WM_KEYUP As Long = &H101Code:
Dim processes() As System.Diagnostics.Process = System.Diagnostics.Process.GetProcessesByName("Notepad")
For Each p As Process In processes
PostMessage(p.MainWindowHandle, WM_KEYDOWN, Keys.F5, 0)
PostMessage(p.MainWindowHandle, WM_KEYUP, Keys.F5, 0)
Nextbut I tried eve nwith it's focused on the text editor there, still nothing happens. No A.