Disabling Alt-Tab and Other Keys

mtgfan2006

New member
Local time
11:57 AM
Messages
6
I have been researching all over the internet for a way to disable the Alt+Tab key combination, and possibly the Windows key as well. There was even a post about this particular topic in this forum (http://www.sevenforums.com/general-discussion/42715-disabling-alt-tab-screen-please-help.html), but it was inconclusive. Registry edits do not seem to work, at least not in Windows 7. I was wondering if there is any way to disable these keys safely. I'm creating a security application that will lock a computer until the correct password is entered. I cannot have people using Alt-Tab or other key combinations while this program is active. Alt-Tab is specifically a problem because it's possible for a user to switch to open programs by using it, hence giving them access to the machine (I don't want to interrupt programs that are running when my program is activated). Also, whatever method used to lock or disable these keys must be able to be used through command prompt since I'm creating this program with a batch file (with some C++ as well). It could be an executable or whatever, but I can't really use a key mapping program because it needs to be automatic when the program is started. Maybe I could use some C++ code to disable these keys? If so, I would really appreciate it if complete code could be posted to do this (as I'm not very savvy with C++ quite yet). I also need something to disable the key restrictions and something to re-enable them separately. Thanks in advance and I hope that I can finally find a solution to this annoying problem! :)
 

My Computer

Computer Manufacturer/Model Number
Dell
OS
Windows 7 Ultimate 64-bit
CPU
Intel Core 2 Quad Q8300 2.5GHz
Motherboard
NVIDIA nForce 650i SLI
Memory
8GB
Graphics Card(s)
ATI Radeon HD 4870 x2
Sound Card
7.1 Channel Audio
Monitor(s) Displays
Dell E228WFP 22"
Hard Drives
500GB Hard Drive
PSU
750W
Case
Dell XPS 630i Case
Cooling
Fans

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self Built
OS
Windows 7 Ultimate 64bit
CPU
AMD Phenom Quad core 9950 black edition
Motherboard
Gigabyte
Memory
16Gb
Graphics Card(s)
2x XFX Radeon 5850
Sound Card
PCI Express X-Fi Titanium / Logitech G35
Monitor(s) Displays
2x HP 2410i
Screen Resolution
1920x1080
Hard Drives
2x 500Gb Seagate
1x 300Gb Seagate
1x 1Tb Seagate
2x 1Tb Hitatchi
PSU
Jean Tech Storm 700W
Case
Cooler Master COSMOS S
Cooling
Akasa Evo Blue Pro
Keyboard
Logitech G15
Mouse
Mad Catz M.M.O. 7
Internet Speed
12mb
If those suggestions don't work you could try finding the process that allows Alt-Tab to work (it's not explorer.exe) and kill that process (if safe) while your lock is in place.
 

My Computer

Computer Manufacturer/Model Number
Apple Macbook Pro (April 2009)
OS
W7 Ult. x64 | OS X
CPU
Intel Mobile Core 2 Duo 2.93Ghz [T9800 Penryn]
Motherboard
NVIDIA nForce 730i Rev. B1 [Mac-F2268EC8 (U2E1)]
Memory
4096MB Samsung DDR3 Dual Channel [PC3-8500F 1066Mhz]
Graphics Card(s)
NVIDIA GeForce 9600M GT 512MB [G96M Rev. C1]
Sound Card
SB X-Fi Surround 5.1 USB | Onboard Realtek (Disabled)
Monitor(s) Displays
Acer x223wbd 22" | Apple Anti-Glare 17" (Disabled)
Screen Resolution
{Current} 1440x900 {Acer} 1680x1050 {Apple} 1920x1200
Hard Drives
{Internal}
Seagate Momentus 320GB 2.5" 7200RPM [ST9320421AS]

{Externals}
LaCie 320GB USB 2.0 HDD [301284UR]
LaCie 750GB USB 2.0 FW400 eSATA HDD [301314U]
LaCie 1TB USB 2.0 HDD [301304UR]
PSU
Magsafe
Case
Aluminum/Unibody (MBP52)
Cooling
2 x 6000 RPM Fans
Keyboard
Logitech G-15v2 [PN 920-000379]
Mouse
Logitech G-9 [PN 910-000338]
Internet Speed
12Mbps/2.5Mbps w/ 24Mbps Speed Boost [Comcast]
Other Info
Logitech X-540 Speakers [PN 970223-0122]
Sennheiser PC-151 Headset
PooMan UK- Thank you for trying to help but I have tried that solution before. I need the change (disabling Alt-Tab and any other keys) to take effect immediately. Like I said, I don't want to disrupt the programs that are running when my program is started. Since you must restart the computer or log out and back in for the registry changes to take effect, this isn't an option for me. I've used many registry changes already in my program (they are safe and tested so don't worry) and they take effect immediately, so why won't these changes take effect immediately as well? It's really annoying!

notsograymatter- I'll take a look into that. I know that it's not explorer.exe because my program kills that process already. Thanks for your help!
 

My Computer

Computer Manufacturer/Model Number
Dell
OS
Windows 7 Ultimate 64-bit
CPU
Intel Core 2 Quad Q8300 2.5GHz
Motherboard
NVIDIA nForce 650i SLI
Memory
8GB
Graphics Card(s)
ATI Radeon HD 4870 x2
Sound Card
7.1 Channel Audio
Monitor(s) Displays
Dell E228WFP 22"
Hard Drives
500GB Hard Drive
PSU
750W
Case
Dell XPS 630i Case
Cooling
Fans
Low-level keyboard hook, anyone?

Well... I tried looking at processes to kill to disable Alt-Tab, but it seems like that's not an option either. I won't be able to kill any vital system processes to kill Alt-Tab. I tried to do so (by running Task Manager as an administrator), and when I tried to disable any important process, I got an "Ending this process will shut down the operating system immediately. You will lose all unsaved data. Are you sure you want to continue?" message (view the attached screenshot (View attachment 83670) to see what this looked like). At that point, I had the option to cancel or check the "Abandon unsaved data and shut down." box and then click the "Shut Down" button. Of course I didn't do this, but at least now I know that I won't be able to disable Alt-Tab safely by killing a process (at least not without crashing the system and/or getting a BSOD). The only other option that I have (at least that I know of) if to create a low-level keyboard hook to disable Alt+Tab, Ctrl+Esc, and Alt+Esc. I've been searching for a few days now for a complete code sample that I can use for my project, but with no success. Could someone please view How to disable task switching on Win32 platforms and tell me what it's missing? I tried compiling this code sample and it's missing something. Please help! Thanks in advance for everyone's help! Also, I've tried typing "#include <windows.h>" in the code sample but I still get an error on the last line of code (the "return CallNextHookEx (hHook, nCode, wParam, lParam);" part). What else needs to be done?
 
Last edited:

My Computer

Computer Manufacturer/Model Number
Dell
OS
Windows 7 Ultimate 64-bit
CPU
Intel Core 2 Quad Q8300 2.5GHz
Motherboard
NVIDIA nForce 650i SLI
Memory
8GB
Graphics Card(s)
ATI Radeon HD 4870 x2
Sound Card
7.1 Channel Audio
Monitor(s) Displays
Dell E228WFP 22"
Hard Drives
500GB Hard Drive
PSU
750W
Case
Dell XPS 630i Case
Cooling
Fans
Why not run your program as a service and just lock the workstation?
 

My Computer

Computer Manufacturer/Model Number
Custom
OS
Windows 7 Ultimate RTM (Technet)
CPU
3.00 gigahertz Intel Core2 Duo E8400
Motherboard
ASUSTeK Computer INC. P5K/EPU Rev 1.xx
Memory
4GB
Graphics Card(s)
ATI Radeon X1950 Pro
Sound Card
Built in HD Audio
Monitor(s) Displays
22" Gateway LCD
Screen Resolution
1920 x 1200
Hard Drives
ST3160023A [Hard drive] (160.04 GB) -- drive 0, rev 8.01, ST3500630AS [Hard drive] (500.11 GB) -- drive 2, rev 3.AAK
ST3500630AS [Hard drive] (500.11 GB) -- drive 1, rev 3.AAK
Keyboard
Logitech G11
Mouse
Microsoft Wireless Laser Mouse 5000
Internet Speed
13.44 Mbps
Why not run your program as a service and just lock the workstation?

That would be too simple. I want to create my own program to lock a workstation. My program even runs at startup and replaces the Windows shell (explorer.exe). Once this program is started you basically can't access the system until the correct password is entered. If you enter the wrong password three times you are logged off. I just thought it would be fun to create something like this, and it's going to be a really cool tool (at least I think) when it's finished. Eventually it will have it's own desktop overlay (kind of like the normal Windows lockout feature) to keep users from accessing open programs while the program is active. Anyway... that's why. lol
 

My Computer

Computer Manufacturer/Model Number
Dell
OS
Windows 7 Ultimate 64-bit
CPU
Intel Core 2 Quad Q8300 2.5GHz
Motherboard
NVIDIA nForce 650i SLI
Memory
8GB
Graphics Card(s)
ATI Radeon HD 4870 x2
Sound Card
7.1 Channel Audio
Monitor(s) Displays
Dell E228WFP 22"
Hard Drives
500GB Hard Drive
PSU
750W
Case
Dell XPS 630i Case
Cooling
Fans
See this page.

Disabling Alt Tab - Vista Forums

See if you can use the AutoHotKey option.

Thanks, Bill2! I'll see if I can get this program to work (since it doesn't have to be installed). I'll post results once I'm finished! Hopefully someone else can benefit from this thread since it's caused me so many problems.
 

My Computer

Computer Manufacturer/Model Number
Dell
OS
Windows 7 Ultimate 64-bit
CPU
Intel Core 2 Quad Q8300 2.5GHz
Motherboard
NVIDIA nForce 650i SLI
Memory
8GB
Graphics Card(s)
ATI Radeon HD 4870 x2
Sound Card
7.1 Channel Audio
Monitor(s) Displays
Dell E228WFP 22"
Hard Drives
500GB Hard Drive
PSU
750W
Case
Dell XPS 630i Case
Cooling
Fans
Success!

Problem solved! I was able to use AutoHotKeys to successfully (and effectively) disable the Alt-Tab key combination. For anyone interested, here's how to do it:

1) Download the zip file located here: http://www.autohotkey.com/download/AutoHotkey.zip (or download the installer http://www.autohotkey.com/download/AutoHotkeyInstall.exe).

2) Open up AutoHotKey and go to File > Edit Script (or create your own script file by opening up notepad and creating a .ahk file).

3) The ONLY code that you have to type to disable the Alt-Tab key combination is "!Tab::return" (without quotes). That's it! All lines beginning with a semicolon ( ; ) are comment lines and you can just ignore or erase them. If you view the help file and read just a little bit you can disable just about any Windows hotkeys that you want. Experiment a little!

4) Now, if you want the file to be portable like I did (without needing AutoHotKey to be installed) you can use the compiler included with AutoHotKey that will convert your file to an executable for you! If you downloaded the zip file, find the "Compiler" folder after you have extracted. If you downloaded the installer, find AutoHotKey in your Start Menu and find the "Convert .ahk to .exe" link.

5) Enjoy being able to use your file on any computer without the need for AutoHotKey to be installed!

I'd also like to thank Bill2 for suggesting this to me. Thanks for helping me with this annoying problem!
 

My Computer

Computer Manufacturer/Model Number
Dell
OS
Windows 7 Ultimate 64-bit
CPU
Intel Core 2 Quad Q8300 2.5GHz
Motherboard
NVIDIA nForce 650i SLI
Memory
8GB
Graphics Card(s)
ATI Radeon HD 4870 x2
Sound Card
7.1 Channel Audio
Monitor(s) Displays
Dell E228WFP 22"
Hard Drives
500GB Hard Drive
PSU
750W
Case
Dell XPS 630i Case
Cooling
Fans
I've tried the AutoHotKey suggestion using the !Tab::return command to no avail. Is there something new now that I'm missing?
 

My Computer

OS
windows 7 home premium 64bit
Just as a heads up, I'd recommend using this code instead if the reason you want to disable alt+tab is for gaming. I needed to disable alt+tab so that I could use push-to-talk (alt) and look at my score (tab) without switching out of the game. Simply disabling alt+tab will prevent me from checking my score while I'm talking. However, this autohotkey code will send tab-down when you press alt-tab (without releasing alt) and tab-up when you let go of tab - which solves my problem.
Code:
LAlt & Tab::Send {Tab Down}
LAlt & Tab Up::Send {Tab Up}
P.S.: Sorry for resurrecting an old thread. I posted this here so others that searched "disable alt tab" in Google could find this, as it was one of the top results.

EDIT: I just noticed it's not all that old... Also, here's a link to the AutoHotKey page instead of a direct link to the download (download button on right side of page last I checked): http://www.autohotkey.com/
 

My Computer

OS
Windows 7 Ultimate x64
Hi guys, in reply the very last post of this thread, I tried to use alt+tab as a keybind in game but it wouldn't work even after I added that code, I just want alt+tab not to minimize and want to be able to use the bind in a game. If anybody knows how to get this to work please let me know, thanks.
 

My Computer

Computer type
PC/Desktop
OS
windows 7
SystemDisc: thanks for that. It works fine, although in my case (CS:GO) it sometimes makes the character sort of half-duck in a quick way. Not sure why that would happen, because I don't have anything movement related binded to Alt or Tab. Anyway it's not really a significant problem.
EDIT: Apparently this combination triggers Ctrl for some reason... weird.

jamesthemang: Here's how I use it, so that it only works in CS:GO:
Code:
#ifWinActive Counter-Strike: Global Offensive
LAlt & Tab::Send {Tab Down}
LAlt & Tab Up::Send {Tab Up}
You can find the exact name of the application you'd like this to work in for example with the Task Manager, in the Applications tab, while the application is running.
(I believe you can also use some other ways to identify an application with AHK, for example when the window title changes, but I haven't had the need to explore those options.)
 
Last edited:

My Computer

OS
Windows 7 64bit
ive downloaded the zip and the installer, the steps aren't accurate enough and got me confused.
what do i open up after opening the zip file. and where do i put in the codes? where do i save it at and as? lol so many questions please help
 

My Computer

Computer type
PC/Desktop
OS
Texas
1. Get AHK (either install it or extract autohotkey.exe from the zip)
2. Open a text editor (Notepad), paste the code, save the file with the extension .ahk
3. Open the .ahk file with autohotkey.exe

That's it.

BTW, this is the code I currently use:
Code:
SetTitleMatchMode 3

#ifWinActive Counter-Strike: Global Offensive
<!Tab::return
You can replace "Counter-Strike: Global Offensive" with whatever game/program you use (it's the window name, the one that you see in the task bar).
 
Last edited:

My Computer

OS
Windows 7 64bit
I just remembered that I had alt-tab set to trigger the L key with that code (<!Tab::l). If you put return instead, it won't trigger anything. Edited the post to avoid confusion.
 

My Computer

OS
Windows 7 64bit
Back
Top