This API is low-level; so applications do not respond to it directly. The function is called by interrupt handler. Maybe you are generating not exactly same input which you think you need for this application to respond. Also, this API is currently superseded by the function
SendInput
which I recommend to use instead of
keybd_event
.
Please see
http://msdn.microsoft.com/en-us/library/ms646310%28v=vs.85%29.aspx[
^].
[EDIT — in respond to OP's comment about direct access to hardware]
It's not easy to tap to hardware directly from the application; if it's even possible without having a kernel-mode (only) custom driver installed, it would suggest OS has a huge security hole. I would rather suggest the problem in your application.
Here is what you can do: create a clear code sample which manifest this problem. You should try to scale down your code to obtain something really minimal, essentially an application skeleton.
Chances are: 1) you will find a problem down the road and fix it; 2) a problem disappears in the skeleton; you will retrace your steps and find out where you added a problem, then the problem will be reduced to case #1 or; 3) your skeleton will not give you a clue but it will be so small that you could post in to CodeProject; in this case, don't create a new page; use "Improve question" on this page; if it happens, please notify me as well by adding a comment to this post — let's see.
—SA