How can a dialog have two different icons?
Hi
I am trying to make my application, which is an MFC dialog based application, have the titlebar/system menu icon different from the one showing in the taskbar.
How can this be achieved?
Thanks
Re: How can a dialog have two different icons?
As far as I know there is only 1 icon. What you could do is handle the minimize/restore events yourself and change the icon when the window is minimized or restored.
Is there any reason to change the windows default behavior ?
Re: How can a dialog have two different icons?
My dialog application can open different dialogs each with its unique icon.. I want all those dialogs to have different icons in their system tray yet they all share the same icon in the taskbar.
Re: How can a dialog have two different icons?
Quote:
Originally Posted by
redserpent7
My dialog application can open different dialogs each with its unique icon.. I want all those dialogs to have different icons in their system tray yet they all share the same icon in the taskbar.
Sorry I meant system menu not *tray
Re: How can a dialog have two different icons?
Quote:
Originally Posted by
redserpent7
Hi
I am trying to make my application, which is an MFC dialog based application, have the titlebar/system menu icon different from the one showing in the taskbar.
How can this be achieved?
Using CWnd::SetIcon
Re: How can a dialog have two different icons?
SetIcon will set the icon for both the title bar and the task bar icons
Re: How can a dialog have two different icons?
Quote:
Originally Posted by
redserpent7
SetIcon will set the icon for both the title bar and the task bar icons
Yes, you are right!
And sorry! I never changed the icon of the main dialog of a dialog based app, I only did it for child windows.
Re: How can a dialog have two different icons?
I wanted to suggest a hack, hoping that Windows uses different resolution of the same icon in the title bar and task bar.
Sorry, no luck – on my system they both use 32x32, 32-bit.
I guess you’d have to handle non-client painting yourself.
Re: How can a dialog have two different icons?
Quote:
Originally Posted by
VladimirF
I guess you’d have to handle non-client painting yourself.
I wont mind doing that except I'm not what the right approach is or how can I get a handle to the taskbar button
Re: How can a dialog have two different icons?
Quote:
Originally Posted by
redserpent7
I wont mind doing that except I'm not what the right approach is or how can I get a handle to the taskbar button
I would suggest to leave the task bar alone (use SetIcon there), and handle NC_PAINT to paint different icon on the title bar of your window.
Re: How can a dialog have two different icons?
Quote:
Originally Posted by
VladimirF
I wanted to suggest a hack, hoping that Windows uses different resolution of the same icon in the title bar and task bar.
Sorry, no luck
Yeah, I did the same test after OP had coplained in the post#6! And couldn't achieve it either. :eek:
1 Attachment(s)
Re: How can a dialog have two different icons?
Handling WM_GETICON does the trick. See the sample.
Re: How can a dialog have two different icons?
Quote:
Originally Posted by
Igor Vartanov
Handling WM_GETICON does the trick. See the sample.
Good point, Igor! :thumb:
Re: How can a dialog have two different icons?
Quote:
Originally Posted by
Igor Vartanov
Handling WM_GETICON does the trick. See the sample.
Super!
Re: How can a dialog have two different icons?
Quote:
Originally Posted by
Igor Vartanov
Handling WM_GETICON does the trick. See the sample.
Wow man, super and excellent all I did was assign ICON_SMALL2 a diiferent icon than ICON_SMALL..
Thanks a lot man...