How do I simulate keystrokes when mouse is clicked in a legacy program. NOTE! The program may not know that the mouse is clicked
I'm experimenting with
IntPtr module = LoadLibrary("user32.dll");
_mouseHookHandle = (HookType.MouseLowLevel, _mouseDelegate, module, 0);
and test to return -1 from the HookProc
. But when I do so, SendInput
don't send my input to the application.
If I return the result from CallNextHookEx
, SendInput
works, but then the mouse click are sended to the legacy application to.
Background
We have a program that is controlled with a special keyboard. When pressing a key on the keyboard, it sends a sequence of ESC and letters. The program then performs an operation based on what the mouse is placed over the screen.
I am developing an on-screen keyboard so that you can control the application without this special keyboard. The user selects a button on-screen keyboard with the mouse. Then the user moves the mouse pointer to the object he wants to send the commando to, and then click again. But that said, mouse click may not be passed on to the program, the program performs another operation at mouse click.