I have following the function which disables windows key, alt-tab, alt+esc, ctrl+esc etc:
This line of code disables Ctrl + Esc (which brings up the start menu)
Unfortunately this disables the Esc key on its own. I actually want to be able to use the ESC key on its own but have the problem of also requiring Ctrl+Esc combination to be disabled. Is there another method I could use?
Thanks,
Andy
public static int HookCallback(int nCode, int wParam, ref KBDLLHOOKSTRUCT lParam)
{
bool blnEat = false;
switch (wParam)
{
case 260:
case 256:
case 257:
case 261:
//Alt+Tab, Alt+Esc, Ctrl+Esc, Windows Key,
blnEat = ((lParam.vkCode == 9) && (lParam.flags == 32)) // alt+tab
|
((lParam.vkCode == 27) && (lParam.flags == 32)) // alt+esc
|
((lParam.vkCode == 27) && (lParam.flags == 0)) // ctrl+esc
|
((lParam.vkCode == 91) && (lParam.flags == 1)) // left winkey
|
((lParam.vkCode == 92) && (lParam.flags == 1));
break;
}
if (blnEat == true)
{
return 1;
}
else
{
return CallNextHookEx(0, nCode, wParam, ref lParam);
}
}
This line of code disables Ctrl + Esc (which brings up the start menu)
((lParam.vkCode == 27) && (lParam.flags == 0))
Unfortunately this disables the Esc key on its own. I actually want to be able to use the ESC key on its own but have the problem of also requiring Ctrl+Esc combination to be disabled. Is there another method I could use?
Thanks,
Andy