donvittorio
Programmer
Hello all,
I'm looking into a problem with message handling within an application. When the app is started a thread is created, and within this thread is a message handler which is assigned to Application.OnMessage. The message handler will only handle custom messages (between WM_USER+6 and WM_USER+11), for all other messages Handled remains False so that they are handled normally.
The handling for one of these messages (MM_SENDKEYS) uses the keybd_event method to simulate key presses, and a loop then uses PeekMessage to check that each of the expected WM_KEYDOWN / WM_SYSKEYDOWN messages are on the queue (without removing them from the queue).
The problem I have is that the KeyDown messages are being processed and removed from the queue before the loop has finished looking for them, so the loop ends up looking for messages that are no longer there!
Is there any way to ensure that the handling of the MM_SENDKEYS messsage is completed before any other messages are processed?
If anybody has any ideas how to solve this them I'm all ears!
Thanks in advance
Steve
I'm looking into a problem with message handling within an application. When the app is started a thread is created, and within this thread is a message handler which is assigned to Application.OnMessage. The message handler will only handle custom messages (between WM_USER+6 and WM_USER+11), for all other messages Handled remains False so that they are handled normally.
The handling for one of these messages (MM_SENDKEYS) uses the keybd_event method to simulate key presses, and a loop then uses PeekMessage to check that each of the expected WM_KEYDOWN / WM_SYSKEYDOWN messages are on the queue (without removing them from the queue).
The problem I have is that the KeyDown messages are being processed and removed from the queue before the loop has finished looking for them, so the loop ends up looking for messages that are no longer there!
Is there any way to ensure that the handling of the MM_SENDKEYS messsage is completed before any other messages are processed?
If anybody has any ideas how to solve this them I'm all ears!
Thanks in advance
Steve