menu setIcon The obtained icon is incorrect

Share your ideas as to how the documentation can be improved.
gekunfei
Posts: 12
Joined: 19 May 2024, 19:34
Contact:

menu setIcon The obtained icon is incorrect

19 May 2024, 19:49

[Moderator's note: Topic moved from Bug Reports.]

Menu.setIcon("xx", "C:\WINDOWS\System32\SHELL32.dll", 130, 32)
icon error
Snipaste_2024-05-20_08-44-27.png
Correct icon
Snipaste_2024-05-20_08-44-27.png (16.23 KiB) Viewed 679 times
Correct icon
Snipaste_2024-05-20_08-41-44.png
error icon
Snipaste_2024-05-20_08-41-44.png (19.93 KiB) Viewed 679 times
User avatar
Ragnar
Posts: 630
Joined: 30 Sep 2013, 15:25

Re: menu setIcon The obtained icon is incorrect

20 May 2024, 01:34

AutoHotkey uses 1-based icon numbers. There's no icon 0. Add 1 to each icon number and you have the icons you want.
gekunfei
Posts: 12
Joined: 19 May 2024, 19:34
Contact:

Re: menu setIcon The obtained icon is incorrect

20 May 2024, 04:15

It's like this, I think this should be emphasized in the help file, which is different from the default icon numbering in Windows
just me
Posts: 9576
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: menu setIcon The obtained icon is incorrect

20 May 2024, 06:23

IconNumber
Type: Integer

If omitted, it defaults to 1 (the first icon group). Otherwise, specify the number of the icon group to be used in the file. For example, MyMenu.SetIcon(MenuItemName, "Shell32.dll", 2) would use the default icon from the second icon group. If negative, its absolute value is assumed to be the resource ID of an icon within an executable file.
What should be emphasized?
gekunfei
Posts: 12
Joined: 19 May 2024, 19:34
Contact:

Re: menu setIcon The obtained icon is incorrect

21 May 2024, 01:07

Emphasize that the icon obtained by win starts from scratch and requires +1 in ahk
lexikos
Posts: 9690
Joined: 30 Sep 2013, 04:07
Contact:

Re: menu setIcon The obtained icon is incorrect

24 May 2024, 19:41

Windows tends to use IDs, not a sequential index; AutoHotkey uses negative numbers for IDs. I don't recall there being any standard OS-provided GUI or utility that will show you an icon number or ID. It's not the documentation author's place to guess where you might have obtained an icon number and whatever scheme it uses.

I think "it defaults to 1 (the first icon group)" is pretty clear. If you miss that, right at the beginning of the documentation for IconNumber, I don't think emphasis will help. It's not as though the documentation can predict the exact thing you're looking for and point it out for you. There could be any number of things that someone else would have liked emphasised at some point in time, but would only be a distraction at any other time.

Return to “Suggestions on Documentation Improvements”

Who is online

Users browsing this forum: No registered users and 4 guests