Disable Alt+Tab


In a kiosk or other specialized environment, you may want to disable switching
between active applications (disabling alt-tab):

Hive: HKEY_CURRENT_USER
Key:
Control Panel\Desktop
Name: Coolswitch
Type: REG_SZ
Value: 1 enable switching
Value: 0 disable switching

The default display for alt-tab is to display 7 icons per row. If you want to
control the number of columns displayed, set it with value CoolSwitchColumns and the number of rows with value CoolSwitchRows.

Problem: I am now running SP6a. At some point between SP3 and now, this
registry hack seems to have stopped working.

http://www.wpostal.com/anglais/api.htm has multiple methods
listed including the following:


Windows NT 4.0 Service Pack 3 and later Windows 2000 Applications can disable ALT+TAB or CTRL+ESC by
installing a low-level keyboard hook. A low-level keyboard hook is installed by calling SetWindowsHookEx.

LRESULT CALLBACK LowLevelKeyboardProc (INT nCode, WPARAM wParam, LPARAM lParam)
{
KBDLLHOOKSTRUCT *pkbhs = (KBDLLHOOKSTRUCT *) lParam;
BOOL bControlKeyDown = 0;
switch (nCode)
{
case HC_ACTION:
{
bControlKeyDown = GetAsyncKeyState (VK_CONTROL) >> ((sizeof(SHORT) * 8) – 1); // Disable CTRL+ESC
if (pkbhs->vkCode == VK_ESCAPE && bControlKeyDown)
return 1;
// Disable ATL+TAB
if (pkbhs->vkCode == VK_TAB && pkbhs->flags & LLKHF_ALTDOWN)
return 1;
// Disable ALT+ESC
if (pkbhs->vkCode == VK_ESCAPE && pkbhs->flags & LLKHF_ALTDOWN)
return 1;
// Disable the WINDOWS key
if (pkbhs->vkCode == VK_LWIN || pkbhs->vkCode == VK_RWIN)
return 1;
break;
}
default:
break;
}
return CallNextHookEx (hHook, nCode, wParam, lParam);
}
NOTE: Although a low-level keyboard hook gets notified when CTRL+ALT+DEL is pressed, it cannot prevent the CRTL+ALT+DEL from
being handled by the system. Another option available is to install a keyboard filter driver, that can prevent keystrokes from being sent
to the system, including CTRL+ALT+DEL. Consult the Windows NT DDK documentation for more information on keyboard filter drivers.

Windows NT 4.0 Service Pack 2 and earlier, Windows NT 3.51 and earlier Applications can disable CTRL+ESC
system-wide by replacing the Windows NT Task Manager, however this is not recommended.
Applications can disable ALT+TAB and ALT+ESC when the application is running by registering hotkeys for the
ALT+TAB and ALT+ESC combinations by calling RegisterHotKey.

Leave a Comment

Your email address will not be published.

Scroll to Top