8

From an OS point of view - memory de-allocation, thread tidy up etc - is there any difference between the 4 ways (I can think of) of closing a running application?

1. Red 'X'

Red X

2. File and Exit

File and Exit

3. Alt + F4

Alt and F4

4. Taskbar - Close window

Taskbar

  • There are actually two more: pressing the red X or middle-clicking on the taskbar thumbnail preview – Alvin Wong Nov 22 '13 at 14:56
  • In Windows 8 you can also close apps by dragging from the middle-top of the screen down to the bottom of the screen, and hold it there until the app flips over. – hemp Nov 25 '13 at 19:55
  • Or double-click the task icon at the left end of the title bar. Or right-click in the interior of the title bar and choose “Close”. (It says it’s equivalent to Alt+F4.) – Scott Dec 19 '13 at 3:26
13

In this specific case, no, there isn't.

All approaches will probably post a WM_QUIT message to the application itself. It will then handle the message by cleaning up all resources and exiting.

However, in theory, there can be a difference. The File menu is completely under the application's control. What items appear in it and what happens if those items are invoked is application-specific. The author of the application could run completely different code when clicking Exit on the File menu than the one that would run when you use Alt+F4.

Even more theoretically, the developer could override the behavior of accelerator keys like Alt+F4 and run different code than what would run when you press the red X.

Changing the behavior of an application so that it doesn't comply with the default Windows behavior and user expectations, in regards to closing applications, is strictly discouraged. But, so is automatically placing shortcuts to applications on the desktop...

While Alt+F4, the red X and the menu entry on the jump list window are probably identical, in that they post the same message, there are other ways to exit an application, like forcing a process to exit. This should generally be avoided unless the application is no longer responding.

As long as you can exit an application gracefully, by closing the associated window, you should do that, because it allows the application to stop what it's doing, possibly finish writing and close open files, and persist your current state. When you forcibly terminate an application, then it doesn't get the chance to do that. You're basically telling the operating system directly to clean up the process (instead of letting the process clean up itself). But the process itself knows much better how to properly clean itself up.

Task Manager will forcibly terminate the process if you select End Process in the Processes tab. If you use End Task in the Applications section, it will post the WM_QUIT message to the selected application window.

| improve this answer | |
  • +1 Good response. But i'm not convinced that ALT + F4 is the same as X in closing a window. eg. in PC Settings (Windows 8+) when we hit X the window closes, but it doesn't exit completely, we can still see it running in the background in tskmgr. However when ALT + F4 instead it terminates completely. This indicates that there's a difference between ALT + F4 and X (or File -> Exit). It could be dependent on the application, or it could be something new to Windows 8+ OSs. I see ALT + F4 as a more forceful way of closing an app (not as dirty as "terminate process", but somewhere in between). – Nikos Dec 26 '16 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.