// JP opened flex table

Click to See Complete Forum and Search --> : Taskbar Close Group question


a1ex07
June 30th, 2008, 04:01 PM
Hi all,
When an application has more than 1 window and taskbar grouping option is turned on, a single taskbar button appears, and a popup menu for this button contains (amid other items) "Close Group".
Is it possible to determine that the application is to be closed due to this command?
Thanks in advance.

ProgramArtist
July 1st, 2008, 11:19 AM
Hi,


Is it possible to determine that the application is to be closed due to this command?
Thanks in advance.


I don't know.

But you can try the following:

Log the messages your app (the main window of your app) receives while closing it.
You can implement your own logger or you can use Spy++ for this.
Spy++ logs many messages if I close my app via the "Close Group" command. WM_SYSCOMMAND is one of them...

After having an idea please do not forget to search the MSDN since it is possible that there are differences between the OS's and their versions.

With regards
Programartist
Ingo Bochmann

a1ex07
July 1st, 2008, 05:48 PM
Spy++ logs many messages if I close my app via the "Close Group" command. WM_SYSCOMMAND is one of them..Thanks for your suggestion, I'll examine WM_SYSCOMMAND parameters, it can be the point.

Maybe I should have explained why I need to detect if 'Close Group' is pressed; it's quite possible that there is an easier way to solve my problem. I have a dialog based application with several modeless dialogs. When a user tries to close any of them, an appropriate confirmation message box pops up. If it's the main window(and the user chooses Yes), then the application is closed; if it's not the main window, then the respective window closed. When 'Close Group' is clicked, all application windows receive WM_CLOSE, whereas I want only the main window to process it.

ProgramArtist
July 2nd, 2008, 01:56 AM
Thanks for your suggestion, I'll examine WM_SYSCOMMAND parameters, it can be the point.

Maybe I should have explained why I need to detect if 'Close Group' is pressed; it's quite possible that there is an easier way to solve my problem. I have a dialog based application with several modeless dialogs. When a user tries to close any of them, an appropriate confirmation message box pops up. If it's the main window(and the user chooses Yes), then the application is closed; if it's not the main window, then the respective window closed. When 'Close Group' is clicked, all application windows receive WM_CLOSE, whereas I want only the main window to process it.

IMHO this seems to be a not-optimized design of your app: Why using a "dialog based application with several modeless dialogs" when there are so good alternatives like SDI, MDI, FormViews, Property Sheets, ...

If you want to have the work flow the way you described: Why not having a main window (as the only one appearing in the taskbar)? This could be the most elegant solution.

But of course re-writing an existing app could be difficult.

With regards
Programartist
Ingo Bochmann

a1ex07
July 2nd, 2008, 11:09 AM
But of course re-writing an existing app could be difficult. Unfortunately, you are right; making design changes at the current stage doesn't seem practicable... Anyway, thanks for your ideas.

//JP added flex table