Reputation: 11
Essentially, I'm looking for a function like PostMessage() that would be synchronous, so it doesn't return until the message has been processed. It doesn't necessarily have to be a function that does that (Because I don't think that there is any) but I'm looking for a way to track the amount of time it takes for a windows message to get processed starting from the time it enters the message queue. SendMessage() would've been very useful but it bypasses the message queue. It's also probably useful to mention that I'm sending the message to a completely different program so it's not on the same thread.
I've tried SendMessage(), but it's not what I'm looking for because I need something that goes through the message queue. PostMessage() isn't suitable either because it returns immediately so I can't track the message. I've looked into hooking to check all the messages getting processed by the other program but I'm trying to find something simpler.
Quick edit to give context: To the people asking why I'm trying this, I'm doing tests to automate the calculation of time for clients applications to recover after they all reconnect to a server at the same time. When they reconnect, they usually freeze and what I found is that the client windows stop processing messages, but if I use SendMessage(), then they still get processed. To the guy that said I need to do automation properly: I'm not sure if this is what you meant but I can't modify the source code of the software that I'm trying to measure so that is not an option, I have to do it from an external software.
Upvotes: 0
Views: 141
Reputation: 2130
Promote @RaymondChen 's comment to answer.
There is nothing built in to do this. The receiving program can compare the current time to the GetMessageTime to determine how long the message waited in the queue. If you cannot change the receiving program, then you'll have to hook its GetMessage.
See WH_GETMESSAGE
.
Upvotes: 0