Page 1 of 1

changing an application icon

Posted: 25 Jan 2021, 14:19
by shemesh
raising an old issue from here https://autohotkey.com/board/topic/73578-changing-an-application-icon

comes a time when i open several instances of the same application, let's say Visual Studio for several projects.
now... looking at the task bar it is impossible to see which task item relates to which project as they all have the same Visual Studio icon.

can i somehow grab a window and change its icon?

see the last reply in the old thread... it works only part way...
it sets only the small icon on the window, but the icon on windows taskbar is not changed.

how do i change an icon for a specific window in the taskbar?

Re: changing an application icon

Posted: 25 Jan 2021, 15:35
by teadrinker
Should work like this:

Code: Select all

WM_SETICON := 0x80
ICON_SMALL := 0
ICON_BIG := 1
IMAGE_ICON := 1

$F1::
   hIcon := LoadPicture("Shell32.dll", "Icon5", IMAGE_ICON)
   SendMessage, WM_SETICON, ICON_SMALL, hIcon,, A
   SendMessage, WM_SETICON, ICON_BIG, hIcon,, A
   Return

Re: changing an application icon

Posted: 26 Jan 2021, 04:16
by shemesh
this is indeed changing the icon on the application window itself.
but it is not changing the icon in windows taskbar.

Re: changing an application icon

Posted: 26 Jan 2021, 04:32
by teadrinker
For me it changes icons on the window title bar and on the taskbar button both. Tested on Windows 7 and 10.
 
 Image

Re: changing an application icon

Posted: 26 Jan 2021, 11:02
by shemesh
mmm... you are right... it does work... in most cases.
for some reason trying this on "ahk_exe webstorm64.exe" does not work.
any idea why?

Re: changing an application icon

Posted: 26 Jan 2021, 18:41
by teadrinker
Tested with PhpStorm, the same result, the toolbar icon was not changed, can't tell why.

Re: changing an application icon

Posted: 31 Jul 2021, 04:38
by shemesh
could the reason be because the running program is a 64bit version??
any way to force it work?

Re: changing an application icon

Posted: 26 Dec 2022, 19:12
by hellen_dorandt89
-----

Re: changing an application icon

Posted: 23 Jan 2024, 15:38
by zotune
any solution to this? small icon works but not big

Code: Select all

SendMessage, WM_SETICON:=0x80, ICON_SMALL:=0, % LoadPicture(A_WorkingDir "\icon.ico", "Icon1", isIcon),, ahk_id %id%
SendMessage, WM_SETICON:=0x80, ICON_BIG:=1, % LoadPicture(A_WorkingDir "\icon.ico", "Icon2", isIcon),, ahk_id %id%