Keyboard Hook - TextBox
Posted on 2009-04-10
I have a C# DLL being called from a C++ App. The C++ App is putting in a Keyboard Hook so that when I try to edit something in a TextBox all the keystrokes go to the main app (as accelertors very funny actually)
So to combat this I installed my own Keyboard Hook in my C# DLL and am able to trap the Keystrokes before they get to the main app and choke them off by not calling the the next Keyboard Hook.
Great. So now I have a wParam and an lParam and I need to send them to the TextBox
At first I tired converting the keycode and manipulating the actual TextBox Text but this started turning into writing my own Text Control ...
I then decided to Use p/Invoke PostMessage and TextBox.Handle and posy WM_KEYDOWN to the textbox gotta work right?
Nope the Main app picked up the message and happily started opening dialogs and stuff as I typed..to add insult to injury nothing showed up in the TextBox.
Any Ideas how to get the Captured Keystrokes to the TextBox?