About Synchronization Objects

Hi, All

I'm debugging a MFC program that simulate keystroke using "keybd_event" function, and I got a problem. I need to handle the result of "keybd_event" function call, so I have to wait for that result and do some processing. The problem is "keybd_event" function is asynchronous and return immediately, so the other fuctions after "keybd_event"will run first and can not catch any data, because "keybd_event" has not finished yet.

I 've searched throug MSDN and found a lot of Synchronization Objects, but I don't know which synchronization object or fuction will fit for my case.

Would you like to tell me the answer

Thanks.



Answer this question

About Synchronization Objects

  • Holiday

    Thanks, Martin.

    I will read this sample for the answer.


  • daniel sovino

    There is no function like this. keybd_event is like your keyboard. You can hit a key at any time and it is queued in the input events.

    If you want to simulate keystrokes you are using the wrong function when you do something like a recording or simulation.

    The journal hook is made for this purpose, see this sample code:

    http://www.codeproject.com/tools/hookmanager.asp



  • Marcelo Paiva

    hi,

    My name is sudheer and I am form INDIA ,iam working on handling the key strokes i have also faced the same problem but i used postmessage ,If you dont mind and if is not coinfidential plz send me a sample code ,may be ,i will able to analyze the problem .



  • About Synchronization Objects