Link to home
Start Free TrialLog in
Avatar of joebenz
joebenz

asked on

SendKeys

I want to send a Cntrl + O to another application. But SendKeys does not work . Any suggestion?
Thnks
Avatar of vinnyd79
vinnyd79

Sendkeys sends to the active window so make sure the other application has the focus.
Avatar of joebenz

ASKER

To Vinnyd79

I did call SetWindowPos but it's still not working
Have you tried using AppActivate to give the app the focus before sending keys to it?
ASKER CERTIFIED SOLUTION
Avatar of guidway
guidway
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Try to set focus with API function:

Declare Function SetFocusAPI Lib "User" Alias "SetFocus"
      (ByVal hwnd As Integer) As Integer

The SetFocus function sets the keyboard focus to the specified window. The window must be associated with the calling thread's message queue.

Try to set focus with API function:

Declare Function SetFocusAPI Lib "User" Alias "SetFocus"
      (ByVal hwnd As Integer) As Integer

The SetFocus function sets the keyboard focus to the specified window. The window must be associated with the calling thread's message queue.

Avatar of joebenz

ASKER

I have to go.
See you Monday at 8Am ET
try the SendMessage function.
Avatar of joebenz

ASKER

To jayes
I have tried SendMessage but ...

Give more details about it.
Avatar of DanRollins
Hi joebenz,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept guidway's comment(s) as an answer.

joebenz, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
Avatar of joebenz

ASKER

Sorry,  had forgotten this question