Sim closes with ALT+F4 without a warning

They should ask Alexander Barthel how it’s done.

Thank you.

I think it would be a terrible idea.
I use alt+F4 when the program has frozen and I cannot even open the task manager. Adding such functionality would completely defeat the purpose of existence of this shortcut.
Just don’t press alt+f4…

3 Likes

If even the taskmanager cannot be opened, you are in serious trouble, and surely ALT-F4 won’t work either. In these cases 5 sec. power button is your last option.
When MSFS doesn’t react anymore, taskmanager/end process is the only solution - but not Alt-F4, because for Alt-F4 to work, the programm still has to react.

It happened to me twice, in the middle of the flight, beautiful scenery, and I wanted to take a quick snapshot with the nvidia tool… Alt-F4 instead of Alt-F1 can happen so easily.
But each to his own - I found my solution with the powertoys.

4 Likes

In Total War Napoleon for example sometimes the game freezes and I cannot interact with the desktop/open task manager, however alt+F4 will still close the program.
Same happens when you have a memory leak (which happened ofter in previous versions of IVAO) and your PC goes so slow clicking ctr+alt+sup would freeze the pc for minutes, alt+f4 is a fast solution that allows you to close everything down without navigating.

So your statement is incorrect in many situations.

Whatever. This thread was opened by a user who sees Alt-F4 as a problem. I offered a solution. I am done here.

4 Likes

I think that there is no good reason to mess with the proper functionality of alt-F4 and my vote would be to leave it the way it is.

I have been using computers since the days of punched cards and I have never ever accidentally pressed alt-F4.

If it is a problem for someone, they have three options:

  1. retrain their fingers
  2. Remove the F4 key
  3. Put a bit of tape over F4
3 Likes

Four options

4 Likes

Or Asobo could code it to display an “Are you sure” Pop up windows …
would take all of 15 minutes to code (and Test) , – (and an eternity to get authorized !!)

3 Likes

Here’s a code example:

When the user closes a window, that action triggers a sequence of window messages.

The user can close an application window by clicking the Close button, or by using a keyboard shortcut such as ALT+F4. Any of these actions causes the window to receive a WM_CLOSE message. The WM_CLOSE message gives you an opportunity to prompt the user before closing the window. If you really do want to close the window, call the DestroyWindow function. Otherwise, simply return zero from the WM_CLOSE message, and the operating system will ignore the message and not destroy the window.

Here is an example of how a program might handle WM_CLOSE.

2 Likes

Yes – Its that easy !!!

1 Like

Pffft. Don’t let the facts get in the way of a good “real computer users/software developers know…” style rant…

1 Like

There are so many keyboard shortcuts in MSFS, using both ALT keys and Function key, it becomes quite easy to make a mistake and hit ALT F4 by mistake, and there there is no going back … or more correctly, there is a Going back – to the a closed app !!

Maybe the episode last year with the “Press any key to continue” has caused a move away from Pop Up windows, but in this case, It would nice to have the “Option”.

3 Likes

As I hinted at earlier in the thread, if LittleNavMap can do it…?

1 Like

Yep, It does close without warning. That is what is was designed to do.
Seems perfectly normal to me. Once you hit it a couple of times, you will remember what the consequences are.

4 Likes

How would the Sim display that message if it’s frozen and not responding?
That in itself is reason enough to leave ALT+F4 as it is. So it will force close the game.

3 Likes

If the sim is frozen then hitting alt f4 possibly doesn’t kill it. You have to kill it from the task manager if the sim is unresponsive.

I am not too familiar with windows signalling system, but i assume it will have something similar to UNIX/Linux/POSIX systems. Those systems have a signalling system where user or other program or the kernel itself can send a signal to a PID. There are a large number of signals, but 2 are important when it comes to stopping / killing a program, those are SIGTERM (similar to hitting ALT-F4 or close button of an windows app) and SIGKILL (similar to killing a process from task manager). The SIGTERM and ALT + F4 can be caught by the application and they can have custom handlers for those events. If an app follows proper design principles, the app should do some absolutely necessary clenups and then close down. But the app can decide to do what ever it wants and can even outright ignore it. Many windows apps actually ask the user to confirm before actually closing it. Usually it’s not a big issue as this can be done using keyboard only without even touching the mouse.

The SIGKILL or termination from taks manager on the other hand is a way to kill the process from kernel. The kernel immediately kills the process if this singal is used. This signal cannot be caught and handled by the app and this apps neither can do any custom cleanup, not can it be ignored. This can cause unclean app closures, save file corruption etc. This is why using this should only be used as a last resort for example for a hung process.

I think it won’t be too bad to have a prompt ask the user to confirm when alt + f4 is hit, like I said, many windows apps already does this. It can really be frustrating to accidentally hit this during a cruise in a mid to long haul flight. If it bothers some people, it can be made optional.

3 Likes

Pretty similar distinction between ‘request to stop, but you can handle it’ and ‘force-kill’ yes, though the low-level mechanism is a little different: WM_CLOSE is a “window message” which is sent by the operating system to the window’s handler procedure via the message pump. Unlike a POSIX signal, messages like WM_CLOSE do not interrupt processing, so if the main thread is stuck, the message is not received. After a timeout (I think something like 20 seconds), the operating system will pop up the “this application has frozen, do you want to force it to exit?” prompt.

Normally, the message handler is run quickly without interruption, and the program can process it and either immediately close the window, or prompt the user, as explained in the documentation from Microsoft linked above.

Indeed, it is normal and recommended practice for applications to prompt the user if they have unsaved state.

3 Likes

To me, that sounds like a feature that should be incorporated within the Windows OS itself and not relying on a particular app to give the warning.

It’s literally a feature of the Windows OS that is provided to applications to use; please refer to the documentation from Microsoft:

1 Like