Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
    
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

1 Answer 1

up vote 12 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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