Hey all, I'm writing an app that uses the PostMessage API call to send keystrokes to another app. All is working well except for the keyboard modifiers. How do I send CTRL + key, alt + key, or shift + key to the app?
Printable View
Hey all, I'm writing an app that uses the PostMessage API call to send keystrokes to another app. All is working well except for the keyboard modifiers. How do I send CTRL + key, alt + key, or shift + key to the app?
*bump*
You need to know about scan codes and virtual keys
This explains Alt-
http://msdn.microsoft.com/library/de...2_wm_keyup.asp
Here is more about virtual key code vs scan code
http://msdn.microsoft.com/library/de...binpt_0hfd.asp
I already know about keyboard scan codes. I'm sending to another app via postmessage so it doesn't have to be in the foreground. The problem I am having is how to send key combinations of alt + a for example to the app running in the background. I've tried sending WM_KEYDOWN and the scancode for alt, then the scancode for a but it doesn't work, just sends the a.
u need to send something, i think in the lparam?
to simulate alt being pressed.
lparam seems to be completely ignored. To test this I even tried making a for next loop to try every # from 0 to 65535. :P
If your curious the program I am trying to send the keystrokes to is Ultima Online. :p
Not to be a PITA - did you even read the first link? It explains how to handle alt - what you're bitchin' about in the next post/
mmmmmm?
ahh yes, the context key stuff is sent in the wparam :rolleyes:
Yeah, I read it several times, but I still can't get it to work. Can someone post an example using postmessage? That would be most appreciated.
Oh and it isn't just Alt I'm trying to figure out, its ctrl and shift as well, is it even possible to send ctrl +key and shift + key?
i'll do a bit of searching for u ;)
Anyone feel like pasting an example or a link that would explain everything?
*bump*
i would suggest having a look on www.planet-source-code.com
someone is sure to have posted a good example ;)
Another possibility is http://www.blackbeltvb.com/
Neither of those links had anything related to what I'm trying to do. Is it even possible to send keystrokes (modifier key + key) or capital letters to apps without bringing them into focus?
bump
Try http://www.codehound.com/ - it is a VB search engine. If there is any code on the web that does what you are asking, it will find it. Start out with putting PostMessage in the search box and see what kind of returns you get.
I think maybe u can try this :
alt + L = "%L"
alt + F = "%F"
I think it works...
Good luck! :)