Results 1 to 4 of 4

Thread: WM_KEYDOWN and WM_KEYUP Conversion to PostMessage or Send Message

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 1999
    Posts
    106

    Question WM_KEYDOWN and WM_KEYUP Conversion to PostMessage or Send Message

    Have this captured which uses a Virtual Key...ugh. Can someone please help me understand what the formatting would be to leverage SendMessage or PostMessage. I have the proper handle and postresult is returning 1, but the target app is not accepting the messages. It's late and I must be overlooking something, thanks for any insight!

    postresult = PostMessage(pgHandle, WM_KEYDOWN, ByVal Asc("3"), 1&)


    Name:  SpyResultsKey3.jpg
Views: 721
Size:  8.2 KB

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Oct 1999
    Posts
    106

    Re: WM_KEYDOWN and WM_KEYUP Conversion to PostMessage or Send Message

    Hmm, what might cause the code to be working in maybe one out of every 10 presses? Making progress, but if I spam the command key maybe 10 times in a row, one of those messages seems to finally get through to the receiving app. Strange as heck, has potential but not sure what else I should be considering (is this a case of timing or...?). Checking out the messages window shows for sure the key presses are being delivered, but like I said very erratic on when/if it gets processed by the receiving app.

    P.S. In testing with notepad, it works flawlessly every single time. So it must be the way the receiving app (which uses a graphical interface like an OpenGl drawing canvas) is processing.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 1999
    Posts
    106

    Re: WM_KEYDOWN and WM_KEYUP Conversion to PostMessage or Send Message

    Hmmm....anyone? Thoughts?

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: WM_KEYDOWN and WM_KEYUP Conversion to PostMessage or Send Message

    PostMessage is not an immediate action like SendMessage is. For testing, maybe try SendMessageTimeOut? That way, your app won't hang if the target app is hung.

    If you are curious, here's a neat page that breaks down the various ways to send/post messages to another window. Only linking it because I think it is a good read for any coder.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

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