Hey,
Is it possible to send keys to a specific windows handle without having to bring that window to focus?
Right now I have the following code almost doing the trick:
Code:Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function SetForegroundWindow Lib "user32" Alias "SetForegroundWindow" (ByVal hwnd As Long) As Integer Sub SendKeysToApplication(ByVal AppTitle As String, ByVal Keys As String) Dim hWnd As Long = FindWindow(Nothing, AppTitle) If hWnd <= 0 Then '*** TO DO *** Window doesn't exist exception End If SetForegroundWindow(hWnd) SendKeys.SendWait(Keys) End Sub
Upon calling it as
It will bring the windows calculator window to the top and set the value "1" on it.Code:SendKeysToApplication("Calculator", "{1}")
My question is: Is it possible to send the keystroke without poping the window?
Thanks!




Reply With Quote