Jump to content

Recommended Posts

Posted

Hi All,

 

I have created an exam environment user interface script that also kills the explorer task and removes task manager etc.. however you are able to close the UI using ALT+F4 and once you have done this you can't do anything at all (not even log off). You have to manually reboot the machine.

 

Is it possible to disable ALT+F4 for a security group? I wan't to avoid regedit unless it can be used for a security group on its own and doesn't affect the machine after the exam user is logged off.

 

Any help appreciated.

 

Cheers.

Posted

Probably best to make the application the shell, then it should reopen should they close it. Also that way explorer never runs.

 

Doable using GPO/GPP

Posted

No, it is not. Alt-F4 is the windows shortcut key for closing an application, it is handled by the application and can only be disabled by a specific application.

 

What I suggest is instead of running your "exams" software directly, create a batch file that runs the exams software using start /wait and then afterwards run logoff.exe to log off the user. Oooor you could write a batch file with a never-ending loop which runs the application again if it is executed.

 

The run this batch file instead.

Posted
That's a good idea, at the moment I have a batch script that runs on logon and a kix sctipt that starts the software and kills explorer.exe so maybe an if statement for if the file is closed it should run again?
Posted
That's a good idea, at the moment I have a batch script that runs on logon and a kix sctipt that starts the software and kills explorer.exe so maybe an if statement for if the file is closed it should run again?

 

Im not a kix expert but im sure you can make the kix script wait for the program to finish executing when you run it somehow.

Posted

It's really easy to completely disable Alt + F4 with the following AutoHotkey script.

 

NoAltF4.ahk

#NoTrayIcon
!F4::Return

 

If you compile the script to an EXE (right-click the AHK file » Compile Script), all you have to do is run it when the users login and they won't be able to close any programs with Alt + F4. :)

  • Thanks 1
Posted
It's really easy to completely disable Alt + F4 with the following AutoHotkey script.

 

NoAltF4.ahk

#NoTrayIcon
!F4::Return

 

If you compile the script to an EXE (right-click the AHK file » Compile Script), all you have to do is run it when the users login and they won't be able to close any programs with Alt + F4. :)

#

Nice! Good one m8. I assume it blocks the windows message chain or something? Probably need to run this 1st?

Posted
I assume it blocks the windows message chain or something?

Yeah. As long as the script is running, the key combo gets intercepted.

 

Probably need to run this 1st?

You only have to install AutoHotkey on your PC in order to compile the .ahk script into an EXE. Once that is done, it can be run via a login script, the HKLM 'Run' key below, or another method.

 

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"NoAltF4"="C:\\Scripts\\NoAltF4.exe"

 

Another way to disable Alt + F4 would be to modify the keyboard scan code map in the registry on each PC they are doing exams on. The following .reg file and PowerShell script both do this, although you could also use Group Policy Preferences to deploy the Scancode Map.

 

NoAltF4.reg

Windows Registry Editor Version 5.00

; Disable Left & Right ALT keys and F4
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,04,00,00,00,00,00,3e,00,00,00,38,00,\
 00,00,38,e0,00,00,00,00

 

or

 

NoAltF4.ps1

# Disable Left & Right ALT keys and F4
Set-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\Keyboard Layout" -name "Scancode Map" -Value ([byte[]](0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x38,0xe0,0x00,0x00,0x00,0x00))

 

These will disable Alt + F4 for every user who logs onto that PC. For the changes to take effect, reboot the computer.

 

To re-enable Alt + F4 simply delete the "Scancode Map" registry value and reboot again.

  • Thanks 1
  • 7 years later...
Posted
Thanks so much for this info. I was able to add the noALTF4 prior to running a game. How would I re-enable the ALT+F4 once I exit out of the game/program beside reboot the PC?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...