Link to home
Start Free TrialLog in
Avatar of jsw3nson
jsw3nson

asked on

Send Alt+key to a window

I need to automate selecting a menu of application.  The application uses a third-party menu control, so I can send a wm_command to the menu.  It does respond to keystrokes, so I would like to do a postmessage that will send the alt+key to the window.  For example 'ALT+F' to open the file menu.  I have gotten to the point were I can do a postmessage to send keys to a text box.  Now I need to know how to add the 'ALT' key too.

Thanks,
Jeff
Avatar of Jeroen Rosink
Jeroen Rosink
Flag of Netherlands image

you might try a line like:
Application.SendKeys "%f"

regards,

Jeroen
Avatar of jarnsater
jarnsater

If the visual basic way (described by roos01 above) does not work, you can try using the win32 API
function "keybd_event".

http://www.vbaccelerator.com/home/VB/Tips/SendKeys_using_the_API/article.asp
http://www.devx.com/vb2themax/Tip/19094
Avatar of jsw3nson

ASKER

Thank you for the replys.

I want to send the key to a window/ application that I do not own.  So application.SendKeys won't work.  Also, I don't want to give focus up when I send the keys so, a keybd_event won't work either.

What I really need is how to send or post a message using WM_KEYUP / DOWN and the 'ALT' key.

Thanks agian for the help.
I think WM_SYSKEYDOWN is the equivalant for sending Alt Control etc
ASKER CERTIFIED SOLUTION
Avatar of Jeroen Rosink
Jeroen Rosink
Flag of Netherlands 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
SOLUTION
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
GPrentice00, Thanks for your effort!
Jeroen