1
votes

I have a MFC dialog based application. User can change the language of the dialog, and I made this by closing existing dialog, and opening another with changed language. The problem is that the effect in the taskbar is that one icon is removed, and another identical is created in its place. If my application's icon is not the last icon in the task bar it will be perceived as it was moved to the end of taskbar icon set.

I want to retain icon's position in the taskbar, and rather to prevent icon flicker at all from happening. How do I do that?

The application must support OS'es from Windows XP to Windows 7.

EDIT: alternative question for which I would accept an answer is how to create an invisible window that is nevertheless shown in the taskbar, and how to forward relevant window messages from that window to my main window?

2
Have you tried opening the new dialog before you close the old one?Mark Ransom
I thought about it, but not sure how to implement it. Currently I call DoModal in a loop. How would I have two modal dialogs opened at the same time, and then close the first one? Also, I think that for a brief moment there would appear two icons in the taskbar. I'm hoping for more efficient solution.Dialecticus

2 Answers

1
votes

Make the dialog a child of another outer parent window. The parent can be a dialog or any other kind of window; all it will be providing is the title bar. If the user tries to resize it it will have to forward resizing commands to the dialog, but otherwise you shouldn't need to do much in the parent window.

1
votes

Why not replace the dialog with a CFormView instead? That way there's a frame window that wraps around the dialog (which is embedded in a form view) and it's the frame window that owns the taskbar icon.

Create an SDI application that displays a CFormView. Display the dialog in the default language (or whatever langauge the user previously chose) on initialization. When the user chooses the 'change language' option, simply change the form view that's being displayed with a new one.

Bonus feature: with this design, the framework will take care of things like language-specific accelerators and menus for you with no effort on your part.

For more on how to do this, check out http://www.codeguru.com/cpp/w-d/doc_view/viewmanagement/article.php/c3341/Multiple-Views-Using-SDI.htm