keybd_event not firing OnKeyPress callback method

I have a form that overrides the OnKeyPress() / OnKeyUp() / OnKeyDown() methods.

When I do a P/Invoke call to keybd_event() it does not make it into these methods. Here is my P/Invoke:

public const int KEYEVENTF_KEYUP = 2;
public const int VK_RETURN = 0x0D;

public void pressEnterKey()
{
//press the enter key
keybd_event(VK_RETURN, 0, 0, 0);
//releasethe enter key
keybd_event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0);
}

Is this a threading issue

Thanks,
-Alan-


Answer this question

keybd_event not firing OnKeyPress callback method