-
May 27th, 2017, 12:26 AM
#1
Thread Starter
Lively Member
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&)
-
May 27th, 2017, 10:31 AM
#2
Thread Starter
Lively Member
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.
-
May 27th, 2017, 07:41 PM
#3
Thread Starter
Lively Member
Re: WM_KEYDOWN and WM_KEYUP Conversion to PostMessage or Send Message
Hmmm....anyone? Thoughts?
-
May 28th, 2017, 06:45 PM
#4
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|