Re: I canīt send keys to other applications in background with sendmessage
I canīt use SendKeys because what I need is to send the keys to an application
in background, and the SendKeys (like keybd_event function) just send the
keys to the application with the input focus.
"Jonathan Wood" <email@example.com> wrote:
>I have a number of suggestions but they depend really on what you need to
>do. So I'll start with the easiest answer: Use SendKeys.
>"Julian Hevia" <firstname.lastname@example.org> wrote in message
>> Few days ago I found some examples about how I could send keys (simulate
>> keystrokes) to another application, but it is not working.
>> The problem is that this application is totally independent from my Visual
>> Basic application, and almost always this application wonīt be in the
>> or with the input focus, so my only way to solve this is sending the keys
>> using sendmessage but it is not working.
>> Here is an example of what I am trying to do:
>> Private Declare Function FindWindow Lib "user32" _
>> Alias "FindWindowA" (ByVal lpClassName As String,
>> ByVal lpWindowName As String) As Long
>> Private Declare Function SendMessage Lib "user32" _
>> Alias "SendMessageA" (ByVal hwnd As Long _
>> , ByVal wMsg As Long, ByVal wParam As Long _
>> , lParam As Any) As Long
>> Dim hWindow As Long
>> dim lngResult as Long
>> hWindow = FindWindow(vbNullString, "OC://WebConnect Pro")
>> 'here I tried to send an "A"
>> lngResult = SendMessageBynum(hWindow, WM_KEYDOWN, 65, 0)
>> lngResult = SendMessageBynum(hWindow, WM_KEYUP, 65, 0)
>> I really would appreciate any help or suggestion.
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL