Wrong icon in shell32 gets used(?)

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
kunkel321
Posts: 1057
Joined: 30 Nov 2015, 21:19

Wrong icon in shell32 gets used(?)

26 Oct 2021, 17:00

An interesting thing I've noticed.... Recently I've been using icons from shell32 so I don't have to keep an icon file with my AHK projects. I've been getting the index number of the icons by simply adding them to a folder, then opening "Desktop.ini" and copying the "shell32.dll,239" part and using it in the code as such:

Code: Select all

menu, tray, icon, shell32.dll,239
I've noticed that I get the wrong icon though. If I then use the next number (index#+1) then it gives me the correct icon. Is this a Windows glitch or something?
ste(phen|ve) kunkel
User avatar
mikeyww
Posts: 26935
Joined: 09 Sep 2014, 18:38

Re: Wrong icon in shell32 gets used(?)

26 Oct 2021, 17:08

I could be wrong about this, but I think that whereas Windows icon numbers are sometimes indexed starting at zero, AHK seems to use a starting number of one, so there might be an offset of one somewhere along the way.
User avatar
JoeWinograd
Posts: 2200
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Wrong icon in shell32 gets used(?)

26 Oct 2021, 17:34

You want a minus sign in front of the icon number:

Code: Select all

menu, tray, icon, shell32.dll,-239
Regards, Joe
User avatar
mikeyww
Posts: 26935
Joined: 09 Sep 2014, 18:38

Re: Wrong icon in shell32 gets used(?)

26 Oct 2021, 17:38

Thank you, Joe! I never noticed that, but I did just see this in the documentation.
If IconNumber is negative, its absolute value is assumed to be the resource ID of an icon within an executable file.
User avatar
JoeWinograd
Posts: 2200
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Wrong icon in shell32 gets used(?)

26 Oct 2021, 17:41

Exactly, mikey! For @kunkel321, that doc is here:

https://www.autohotkey.com/docs/commands/Menu.htm#MenuIcon

Regards, Joe

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: inseption86, mikeyww and 467 guests