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
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