Click here to Skip to main content
15,907,392 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I'm using SetWindowHookEx with WH_KEYBOARD_LL to hook keys on keyboard, and the result, I can hook a single key such as Ctrl (VK_LCONTROL, VK_RCONTROL) or "A" key (0x41)

C++
if ((p->vkCode == VK_LCONTROL) || (p->vkCode == 0x41))


p is a pointer to (KBDLLHOOKSTRUCT *)(lParam)

However, I don't know how to hook multiple key "Ctrl + A", I used:

C++
if ((p->vkCode == VK_LCONTROL) && (p->vkCode == 0x41))


but there's no result...

Please help me.
Thank you
Posted
Comments
SVPro 10-Apr-12 5:33am    
Hi OrginalGriff,

But when I try to change Ctrl key by Alt key (VK_MENU), it don't work???
Alt+A = not work
Ctrl+Alt+Del = not work

Once more, when I hook Ctrl + Alt only, when I press Alt key, after some seconds, I continue pressing Ctrl key, it's still hooked??

Please help me!

1 solution

Try using:
C++
if (GetAsyncKeyState(VK_CONTROL) && (p->vkCode == 0x41))
 
Share this answer
 
Comments
SVPro 10-Apr-12 4:51am    
Thank OriginalGriff, it's good!
OriginalGriff 10-Apr-12 5:03am    
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900