Link to home
Start Free TrialLog in
Avatar of MOPUser
MOPUser

asked on

Alt + F4 hot key disable

Hi All

I would like to disable the Alt + F4 short which closes active windows within Widnows. Spefically Microsoft Office applcations word, excel etc.

Our users have new laptops with samll keyboards, some usesrs have been hitting this combination of keys by mistake and clicking not on the save prompt.

I thought this would be a standrd regedit but cant spot a conslusive answer online.

Many Thanks
Avatar of Mike Schrock
Mike Schrock
Flag of United States of America image

Haven't needed it myself however few folks have said using AutoHotKey https://www.autohotkey.com/ with this code attached to it:
#NoTrayIcon
!F4::Return

Open in new window

from this website: http://www.edugeek.net/forums/windows-server-2008-r2/121900-disable-alt-f4.html

Good luck, should still work and if it is a startup program or something fairly easy to GPO or startup program it.
Avatar of ☠ MASQ ☠
☠ MASQ ☠

Or switch off using the Scancode section of your Registry

Switch off F4 key
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
 "Scancode Map"=hex:00,00,00,00,00,00,00,00,06,00,00,00,00,00,5B,E0,00,00,5C,E0,00,00,3e,00,00,00,0f,00,00,00,01,00,00,00,00,00

Open in new window


Switch on F4 key
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
 "Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,00,00,00,00

Open in new window

Just a comment:

I'm not sure whether ignoring ergonomics and disabling the default UI interaction will make users happy or not.
Whats to stop them using the X at top right rather than Alt-F4? The X does have limitations, for example in Excel it closes the file rather than the application if more than one file is open.
If you like Mike's suggestion but are not familiar with the AutoHotkey language, this EE article will get you going on it:
AutoHotkey - Getting Started

Since you'll be rolling it out to all your users, you'll want to compile it into a stand-alone executable (an EXE file) so that you don't have to install AutoHotkey on their computers. That article explains how to use the AutoHotkey compiler to create an EXE.

AutoHotkey is a very robust language for Windows (and MS Office) automation. It exposes many elements of the Windows API in an easy-to-use language and has native support for COM (Component Object Model) calls. If you wind up liking AutoHotkey, these other EE articles and video Micro Tutorials provide somewhat of a mini-course in the language, each with some sample code:

Test IP Addresses with PING
Answer Skype Calls with Bluetooth Headset
How to copy the short link of an ID at Experts Exchange to the clipboard with a single keystroke
How to solve the problem of incorrect System Uptime being reported when a system has been up for a long time (approximately 50 days or more)
How to create an on/off toggle to mute the system audio/sound with a single mouse click or single keystroke
On-Screen Display for CapsLock State (On or Off)
On-Screen Display for CapsLock State (On or Off) - Enhanced
Check for and download updated file - Example - FileZilla
How to download number of Views, Endorsements, Points for Experts Exchange Articles and Videos
How to download number of Views, Endorsements, Points for Experts Exchange Articles and Videos--Demo
ArticlesVideosEE: Download statistics on Experts Exchange Articles and Videos - Demo of Enhancements
How to move all windows on one monitor to another monitor with a single keystroke

Good luck with AutoHotkey...it's a great language to have in your IT toolkit. Regards, Joe
Our users have new laptops with samll keyboards, some usesrs have been hitting this combination of keys by mistake and clicking not on the save prompt.
And clicking on the close X? The problem is users not saving. Enable automatic saving
and clicking not on the save prompt.
Heck !!
Users have a prompt and intentionnally click "No", not much you can do with software solution as this is a human behavior that need to be changed in the first place.

Plus, I'm nowhere near convinced that disabling a standard Windows feature for the convenience of a few users will make the majority happy.

They loose their work, their loss. Scowl at them / educate them.
You can do this for specific applications like this so alt+f4 still functions everywhere else.

#IfWinActive ahk_class EXCEL.EXE
!F4::return

#IfWinActive ahk_class WINWORD.EXE
!F4::return

Open in new window

This will stop alt+f4 from closing word or excel.

Or this way.
#If WinActive("ahk_exe EXCEL.EXE") or WinActive("ahk_exe WINWORD.EXE") or WinActive("ahk_exe PowerPnt.exe") 
!F4::return

Open in new window

This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.