Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Disabling Alt-Tab and Other Keys

05 Jul 2010   #1

Windows 7 Ultimate 64-bit
 
 
Disabling Alt-Tab and Other Keys

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 (Disabling alt+tab screen? Please help), 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 System SpecsSystem Spec
.

05 Jul 2010   #2

Windows 7 Ultimate 64bit
 
 

My System SpecsSystem Spec
05 Jul 2010   #3

W7 Ult. x64 | OS X
 
 

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 System SpecsSystem Spec
.


05 Jul 2010   #4

Windows 7 Ultimate 64-bit
 
 

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 System SpecsSystem Spec
06 Jul 2010   #5

Windows 7 Ultimate 64-bit
 
 
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 (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?
My System SpecsSystem Spec
07 Jul 2010   #6

Windows 7 Ultimate RTM (Technet)
 
 

Why not run your program as a service and just lock the workstation?
My System SpecsSystem Spec
07 Jul 2010   #7

Windows 7 x64 pro/ Windows 7 x86 Pro/ XP SP3 x86
 
 

See this page.

Disabling Alt Tab - Vista Forums

See if you can use the AutoHotKey option.
My System SpecsSystem Spec
07 Jul 2010   #8

Windows 7 Ultimate 64-bit
 
 

Quote   Quote: Originally Posted by MacGyvr View Post
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 System SpecsSystem Spec
07 Jul 2010   #9

Windows 7 Ultimate 64-bit
 
 

Quote   Quote: Originally Posted by Bill2 View Post
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 System SpecsSystem Spec
07 Jul 2010   #10

Windows 7 Ultimate 64-bit
 
 
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/A...keyInstall.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 System SpecsSystem Spec
Reply

 Disabling Alt-Tab and Other Keys




Thread Tools



Similar help and support threads for2: Disabling Alt-Tab and Other Keys
Thread Forum
Keys that have FN functions on them not working as normal keys General Discussion
Disabling ToolTips? General Discussion
Solved Disabling Touchpad Hardware & Devices
How Can I Disable The Multimedia Keys Covering The F1-F12 keys? Hardware & Devices
Help ! DWM keeps Disabling itself Customization
please help with disabling Hibernate (thanks) General Discussion
Disabling UAC... wow System Security

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 08:14 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33