Disabling system keys (alt+f4 - alt+tab)

Hi! I’m trying to make a very inmersive game, with a main character that talks with the player. The character is terrified with the possibility that player closes the game. By this reason I want to control how the player closes the game itself, disabling keybindings like alt+f4 to close the game or alt+tab to change window. It can be sound like something malicious but is only a game design decission that I would like to implement if it is possible. Do you know any option to disabling this system keys? In blueprints if it’s possible. Or maybe in console? Thanks!

You can’t disable Alt+F4 and Alt + Tab as they are a part of Windows.

If your game freezes or crashes, then you need a way to force quit the game without needing to your task manager and close Windows

(Old thread, adding a reply anyway in case anyone else runs into this thread.)

For Alt+F4 this post explains how to disable it, so apparently that’s actually possible:

for system keys like alt+tab and the windows key, unreal input will never see them. windows eats those combos before they reach the game window, so no input mapping or UI focus trick can catch them. the only thing that works is a low level keyboard hook that swallows the keystroke at the OS layer.

for alt+f4 specifically you get a window close request instead of a key event, so bind UGameViewportClient::OnWindowCloseRequested if you want a clean exit path in C++.

if you want to lock down a packaged UE5 game on a public screen without writing that hook yourself, Kiosk Lockdown Toolkit is a kiosk mode plugin for Unreal Engine 5 that does the keyboard filtering, win keys, alt+tab, alt+esc, alt+f4 and the task manager shortcut, each switchable: Kiosk Lockdown Toolkit — Block Alt+Tab, Win Key & Taskbar for Kiosks | Fab

one honest limit: ctrl+alt+del is handled by windows itself and no application can block it, so pair it with a windows policy if that combo has to be closed too.