I have some windows application that can change his icon, using win api functions
SendMessage(hwnd, WM_SETICON, ICON_BIG, icon_handle);
SendMessage(hwnd, WM_SETICON, ICON_SMALL, icon_handle);
Shell_NotifyIcon(...);
It changes icon in taskbar and tray (taskbar notification area), but icon in taskmanager still not changed. How can I change icon in taskmanager? Is it possible?
From this SO answer
EDIT:
According to the this SO answer, the icon needs to be a .ICO file created by an icon editor; this SO article also mentions that you need to send the message to the top-most window of the application.
I could switch the icon in the task bar, alt-tab and in the task manager by
a) creating an icon using the Visual Studio Resource Editor
b) loading the icon with code like
HICON hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON1));
c) sending
WM_SETICON, ICON_SMALL
to the topmost window -- I was using a MFC SDI application, so I sent the message to the main frame window (AfxGetApp()->m_pMainWnd
)NOTE: a comment in the MSDN Docs for WM_SETICON mentions
It is a general Windows bug. Task manager and explorer remember icons associated with files for a very long time. If your icon has lowest ID in exe, it should appear as the application icon in task manager (root node). But if you changed it recently, it may not work. The icon of the window itself is a quite different thing - if it isn't displaying, your code is wrong.