|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
SendKeys to another app don't work intentionallycalculator application (calc.exe). Efter focus I try simply to pass the number 5 to the application. The calculater gets focus and is shown, but the number 5 is not displayed. Have I missed something? Sub SetWindowFocus() Dim hwndApp As IntPtr Dim hwndForeground As IntPtr Dim ThreadForeground As Integer hwndApp = FindWindow(vbNullString, "Lommeregner") If Not hwndApp.Equals(IntPtr.Zero) AndAlso _ Not hwndApp.Equals(GetForegroundWindow) Then ThreadForeground = GetWindowThreadProcessId(hwndForeground, IntPtr.Zero) AttachThreadInput(ThreadForeground, 0, True) SetForegroundWindow(hwndApp) AttachThreadInput(ThreadForeground, 0, False) End If SendKeys.SendWait("5") 'SendKeys.Send("5") End Sub Regards /Snedker On Fri, 06 Oct 2006 12:24:27 +0200, Morten Snedker
<morten_spammenot_ATdbconsult.dk> wrote: I put the sendkeys on a timer with 1sec delay. This seems to help. Furthermore I need to use SendWait to make it work. /Snedker Sir, you try sending the actual number 5 key instead of the text, "5".
|
|||||||||||||||||||||||