Results 1 to 19 of 19

Thread: PostMessage

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2001
    Posts
    10

    PostMessage

    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?

  2. #2

    Thread Starter
    New Member
    Join Date
    Dec 2001
    Posts
    10
    *bump*

  3. #3
    jim mcnamara
    Guest
    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

  4. #4

    Thread Starter
    New Member
    Join Date
    Dec 2001
    Posts
    10
    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.

  5. #5
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    u need to send something, i think in the lparam?

    to simulate alt being pressed.

  6. #6

    Thread Starter
    New Member
    Join Date
    Dec 2001
    Posts
    10
    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.

  7. #7
    jim mcnamara
    Guest
    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?

  8. #8
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    ahh yes, the context key stuff is sent in the wparam

  9. #9

    Thread Starter
    New Member
    Join Date
    Dec 2001
    Posts
    10
    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.

  10. #10

    Thread Starter
    New Member
    Join Date
    Dec 2001
    Posts
    10
    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?

  11. #11
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    i'll do a bit of searching for u

  12. #12

    Thread Starter
    New Member
    Join Date
    Dec 2001
    Posts
    10
    Anyone feel like pasting an example or a link that would explain everything?

  13. #13

    Thread Starter
    New Member
    Join Date
    Dec 2001
    Posts
    10
    *bump*

  14. #14
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    i would suggest having a look on www.planet-source-code.com

    someone is sure to have posted a good example

  15. #15
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Another possibility is http://www.blackbeltvb.com/

  16. #16

    Thread Starter
    New Member
    Join Date
    Dec 2001
    Posts
    10
    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?

  17. #17

    Thread Starter
    New Member
    Join Date
    Dec 2001
    Posts
    10
    bump

  18. #18
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    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.

  19. #19
    Member
    Join Date
    May 2001
    Location
    Malaysia
    Posts
    43
    I think maybe u can try this :

    alt + L = "%L"
    alt + F = "%F"

    I think it works...

    Good luck!
    Ben Chin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width