changing an application icon

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
shemesh
Posts: 23
Joined: 19 Mar 2019, 16:45

changing an application icon

Post by shemesh » 25 Jan 2021, 14:19

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?
teadrinker
Posts: 4331
Joined: 29 Mar 2015, 09:41
Contact:

Re: changing an application icon

Post by teadrinker » 25 Jan 2021, 15:35

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
shemesh
Posts: 23
Joined: 19 Mar 2019, 16:45

Re: changing an application icon

Post by shemesh » 26 Jan 2021, 04:16

this is indeed changing the icon on the application window itself.
but it is not changing the icon in windows taskbar.
teadrinker
Posts: 4331
Joined: 29 Mar 2015, 09:41
Contact:

Re: changing an application icon

Post by teadrinker » 26 Jan 2021, 04:32

For me it changes icons on the window title bar and on the taskbar button both. Tested on Windows 7 and 10.
 
 Image
shemesh
Posts: 23
Joined: 19 Mar 2019, 16:45

Re: changing an application icon

Post by shemesh » 26 Jan 2021, 11:02

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?
Last edited by shemesh on 31 Jul 2021, 04:36, edited 1 time in total.
teadrinker
Posts: 4331
Joined: 29 Mar 2015, 09:41
Contact:

Re: changing an application icon

Post by teadrinker » 26 Jan 2021, 18:41

Tested with PhpStorm, the same result, the toolbar icon was not changed, can't tell why.
shemesh
Posts: 23
Joined: 19 Mar 2019, 16:45

Re: changing an application icon

Post by shemesh » 31 Jul 2021, 04:38

could the reason be because the running program is a 64bit version??
any way to force it work?
zotune
Posts: 85
Joined: 17 Nov 2014, 17:57

Re: changing an application icon

Post by zotune » 23 Jan 2024, 15:38

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%
Post Reply

Return to “Ask for Help (v1)”