How do i disable the system shortcut key after the game begins?

I want to find a solution that can disable some of the system’s shortcut keys, such as Windows keys, Alt+Tab shortcuts, and so on. It seems that in the Unity project, only interactive buttons can be defined, and the shortcut keys of the system cannot be banned. If you have any good ideas, please let me know. Thank you very much!

system shortcuts should never be suppressed by a “normal application”. They may be the only way to exit / terminate the application. Games really shouldn’t even think about something like that. If you block things like Alt+Tab or Alt+F4 most users wouldn’t be pleased. It’s still the user whos operating the computer and not the game.

However if you really need to block certain hotkeys the only way is to install a lowlevel keyboard hook(WH_KEYBOARD_LL) with the win API. This has to be done in a seperate thread. The thread need to run a message pump (Call GetMessage in an infinite loop).

The actual hook method that is called for any keyboard event usually calls “CallNextHookEx” to pass the event on to other hook and the system. Here’s where you can block “most” key events. Though certain hotkeys / key combinations can’t be blocked since they are handled before the hook mechanic. One is CTRL+ALT+DEL