The very first thing I notice when using this method to quickly close a running program/game is potential data loss, like settings. But if I'm perfectly OK with that, will keeping doing this cause any long-term harm to the system, either software or hardware like RAM?
Also, I'd like to know what Alt+f4 actually does? If it actually tries to kill the associated process, it would take no time for the program/game to close, but as I noticed, some games (and most of them) freeze for some seconds before actually closing, while if I kill their processes in Task manager, they will close almost immediately.
One more thing I know is many games and programs seem to have been implemented with this as a hotkey for quick-exit, so they will actually ask if I want to quit and save the progress before quitting, just like normal procedure.
12 Answers
Alt-F4 is the windows command to close an application.
The application itself has the ability to execute code when ALT-F4 is pressed.
You should know that alt-f4 will never terminate an application while being in a read/write sequence unless the application itself knows it is safe to abort.
When talking about games, developers often do not keep in mind that people press the ALT-F4 to quickly exit a game. If the game is saving at that moment (often seen by an indicator of some sorts with a message: do not power off the computer if you see this indicator) and you press ALT-F4, the chances are high that the profile will become corrupt and your savegame is lost.
As for implementation, it works the other way around. Since this is a windows shortcut key, unless a program/game explicitly prevent ALT-F4 to not exit its program, it will always work.
5alt+f4 is a built-in OS shortcut which, when triggered, will send a SIGINT signal to the process managing the active window. SIGINT (as for signal interrupt) is a signal meant to tell the process that is has been requested to stop. When developing an application, you can define in it's behavior that it can "catch" a signal, meaning that you modify the course of action automatically defined by the application when it receives such signal.
A good example of this would be a text editor. Any application receiving a SIGINT will exit, however, developers of text editors will preferably override this behavior to ask the user if it wants to save the current opened file before exiting. In that case developers tell the program not to exit when receiving the SIGINT, but instead prompting the user, and depending on the user choice, manually exit (for example, in Microsoft Word, if the user chooses cancel, the program won't exit, even if it received a SIGINT).
There are several signals with different uses, and there even are several signals regarding exiting an application. Theoritically, you can choose the behavior you want for any of these. SIGINT, for example, could be considered a "soft" exit signal. SIGKILL, on the other hand, is the hardest exit signal that exists, and should never be overriden, as if it is sent, it is usually because the user wants immediate interruption of the program, no questions asked. I could bet, for example, that if you sent a SIGKILL to Microsoft Word, it would exit immediately, even if you have unsaved changes.
1