

That said…Īs the question you've found points out, there is no built-in way to distinguish the "Close all windows" from a regular "Close window" command. And while annoying, it seems like a minor annoyance, and frankly one that might teach the user to not use the "Close all windows" option when they have left a bunch of these windows open. I can see how having several prompts to save/cancel changes could be annoying, but it doesn't seem confusing to me. Personally, I would just leave things as they are. Odd form closing behavior when using taskbar's Close All Windows This question is somehow related to this one: (see How can I distinguish between "Close All Windows" and "Close" individual windows in MFC with Windows 7?)īut how can I evaluate this, before I execute the closing-routine for any other window?ĬomponentDispatcher.ThreadPreprocessMessage in my mainwindow comes too late, it fires after some other window has started the closing procedure. I have already found out, that I probably need to check the Windows Message Loop of my MainWindow for some WM_SYSCOMMAND with wparam SC_CLOSE. If yes, all windows should close silently, otherwise stay open.īut my MainWindow is not the first one, to process the closing procedure. What I want is: If the MainWindow is asked for closing, I want to prompt once, if that's ok. This is annoying and confusing if there are many of those. Some of my windows may ask before closing, if it's okay to cancel pending changes. If it is clicked, each Window of my application gets an individual close-command in an order I cannot control. If these windows get grouped in the taskbar, windows will provide the action "Close all Windows" in the taskbar context menu. there is always one MainWindow and optionally many others with no owner. I have a WPF-application with multiple unrelated Windows, i.e.
