// JP opened flex table

Click to See Complete Forum and Search --> : WH_KEYBOARD_LL -> Control Key Problem


gold_duke
February 22nd, 2007, 05:35 AM
Hello,

I have wrote a LowLevelKeyboard Hook, and I attempt to intercept the Ctrl+W key and to replace that with a "Q" key event to compensate a broken key.

I have successfully intercepted the Ctrl+W combination but when I send in the "Q" the application actually gets a Ctlr+Q.

Here is the code that sends the Q:

[....code that executes when Ctrl+W is pressed....]

//Raise the CTRL key.... (doesnt seem to work...)
keybd_event( VK_RCONTROL, 0x1D, KEYEVENTF_KEYUP, 0 );
keybd_event( VK_CONTROL, 0x1D, KEYEVENTF_KEYUP, 0 );

//Send the "A" key
keybd_event( 'A', 0, 0, 0 );
keybd_event( 'A', 0, KEYEVENTF_KEYUP, 0 );

//return non-zero to prevent "W" to be sent...
return 1;

So any ideas on how to simulate CTRL-UP (although is still being pressed on the keyboard) that does work :)?

Thank you very much!

- Ilie

ovidiucucu
February 22nd, 2007, 06:19 AM
I have wrote a LowLevelKeyboard Hook, and I attempt to intercept the Ctrl+W key and to replace that with a "Q" key event to compensate a broken key.
[...]
So any ideas on how to simulate CTRL-UP (although is still being pressed on the keyboard) that does work :) ?
A cheap new keyboard with no broken key can save you from a lot of painful headaches. :D ;)

gold_duke
February 22nd, 2007, 09:02 AM
Thank you for you reply.

In the mean time I have solved the problem.

The issue is that RControl is an EXTENDED key so that flag also has to be added into the keybd_event function.

Now it works like a charm. Same code but with the extended flag.

//JP added flex table