Dynamic taskbar icon depends on configuration of taskbar? - c++

I implemented the possibility to load a custom taskbar icon during runtime dynamically (according to How to set the Windows taskbar icon during runtime? ).
Now I noticed a strange behaviour: the new taskbar icon is set correctly, but Windows 7 still shows the old (original) icon when the "Taskbar buttons" in properties of taskbar are configured to "Always combine, hide labels". When choosing one of the other options the custom icon is shown.
So: any idea what causes this or how to overcome tihs problem? I want to show the custom icon in all configurations of taskbar.
Thanks!

Related

Taskbar icon appears blank (possibily due to a sticky cache)

I am having some issues with invalidating the Windows icon cache. I'm running a Win32 app that used to show the taskbar icon properly, however, after replacing the app's icon, the taskbar icon appears blank. It's interesting because when I use ALT-TAB, the correct icon does show up.
The window is created with WS_EX_APPWINDOW. I know it registers the correct icon because after pinning/unpinning it from the taskbar, the icon shows up as expected. I’ve gone through several attempts to solve this and have narrowed it down to refreshing the icon cache.
A few of the ways I tried to reset the icon cache:
Delete all icon cache files in folder:
%LOCALAPPDATA%/Microsoft/Windows/Explorer/, and restart explorer.exe
In Command Prompt: $ie4uinit.exe -show
Using Shell APIs to force the taskbar to refresh (SHChangeNotify)
Having gone through several different attempts and configuration techniques, the taskbar icon remains blank as shown above. I was wondering if there is another foolproof technique for resetting the Windows icon cache.

How to Set Desktop shortcut icon different and task bar icon different for a QT Windows application?

I need to set title.ico as my application icon and shortcut.ico as my desktop shortcut. Is there any way to do it in a Qt application itself while building?
Whenever the user right-clicks on my application and clicks on sendto->desktop(create shortcut), the shortcut should have shortcut.ico. But now it's always displaying title.ico.
I checked WinApi IShell_link but it didn't help.
I am also a beginner, but turns out this is possible. See this thread: https://forum.qt.io/topic/45324/taskbar-icon-different-from-the-icon-of-the-window/8
Hope I understood you right. Enjoy!
Edit 2018-03-13:
Create your icon in diffrent sizes (e.g. 16px, 32px, ...) as an .ico (while on Windows), for further information visit: http://doc.qt.io/qt-5/appicon.html
Call QWindow::setIcon() (http://doc.qt.io/qt-5/qwindow.html#setIcon)
Profit. The icon should now be visible in the greater resolution in the taskbar, while the smaller one is choosen for the app window.

Cannot display new icon for the application

I am trying to change the icon of the application, and I have changed it and the project builds completely fine.
But when the application starts, I still see the default icon on the taskbar. On the otherhand, when I click on About, I can see the new Icon.
What am I missing?
You need to make sure that the resource ID of your icon is the lowest of all the icons in your resources. Windows will display the icon with the lowest ID.

Changing program icon dynamically

In C++, is there anyway to let the user chose the icon of the app? For example, Winamp lets you select which icon you wish to use from a list of icons in it's preferences. How is it done?
There is the icon that you see in explorer. This is a resource in your executable. You could change that, but I wouldn't advise you too. Virus scanners can get nervous if executables are modified, and in Windows Vista you will not even be allowed to write in the Program Files folder.
But the icon that is displayed on the task bar or in the system tray can be changed. This is actually the icon of your application window and it can be set by sending a WM_SETICON message.
And there are shortcuts. They can be changed too, and in a shortcut you can specify which icon should be used.
I found a discussion on changing icons that has information about the first two options.
For Visual Studio 2010 in an MFC dialog based app
A. In the resource view, rightclick Icon folder and add icon. Give it an ID like IDI_MYICON. Leave it as is or draw something nice.
B. Go to OnInitDialog. Add the following two lines of code:
HICON hMyIcon = LoadIcon( AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_MYICON) );
SetIcon( hMyIcon, FALSE ); // FALSE == use as small icon
You can read about these functions in the help to understand what is happening.
This sets the icon as icon for the sysmenu (topleft) and in the taskbar. This is however not automatically reflected in all situations. E.g. for a systray icon you need to explicitly specify the icon again in the call to Shell_NotifyIcon().

regarding mfc dialog bar

I am new to MFC and VC++ programming. I have two questions:
How do I make a resizable dialog bar?
How do I give background color for a dockable dialog bar?
Thanks!
So i assume we are working in visual studios 2008 or similar and i assume you have an MFC SDI or MDI application that you are working on.
Open the resource viewer (View->resource view).
Expand the project that you would like to place the dialog in.
Expand to the dialog folder.
Right click this folder and click add resource.
Expand and add a new dialog bar.
Give it any properties you like using the properties window.
To (display/ give context) your dialog bar, instantiate and get the
handle of the dialog. Like
GetDlgItem(ID)-> ShowWindow(SW_SHOW);//show
Where ID is the id of the dialog. You can obtain this by going into the resource viewer, right click on the dialog, properties, and the ID is given in there.