I am trying to connect a keyboard in my program, but there is something that I cannot perform. The method below is the most important part of my class, where I handle certain key combinations. They all work, but I also want to enable Ctrl-Alt-Tab. I spent hours trying to figure out what to do, but I came empty-handed. How can I intercept this combination?
Additional information can be found here:
http://msdn.microsoft.com/en-us/library/ms644967(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms927178.aspx
private static IntPtr KeyboardHookHandler(int nCode, IntPtr wParam, KBDLLHookStruct lParam)
{
if (nCode == 0)
{
if ( ( (lParam.flags == 32) && (lParam.vkCode == 0x09) ) ||
( (lParam.flags == 32) && (lParam.vkCode == 0x1B) ) ||
( (lParam.flags == 0 ) && (lParam.vkCode == 0x1B) ) ||
( (lParam.flags == 1 ) && (lParam.vkCode == 0x5B) ) ||
( (lParam.flags == 1 ) && (lParam.vkCode == 0x5C) ) ||
( (lParam.flags == 32) && (lParam.vkCode == 0x73) ) ||
( (lParam.flags == 32) && (lParam.vkCode == 0x20) ))
{
return new IntPtr(1);
}
}
return CallNextHookEx(hookPtr, nCode, wParam, lParam);
}
source
share