So, I'm running this:
AutoHotkey 1.1.24.05 Unicode on Windows 7 Pro x64
I have a dll with some icons in it. One of the ahk updates caused my script to break, and I've pinned the culprit down: LoadPicture().
Actually, I have the same problem without using LoadPicture():
There are only around 36 icons in the library, but this count comes up with over 8000.
This used to work in a former version of ahk, but I don't remember which one. Apparently the function was changed and doesn't inspect the dll the same way?
It doesn't have this problem with every dll. But I am making my own dlls, just like I've done for years. Basically, I just use a C compiler to create the dll with icons in an .rc file. That .rc file looks like this:
0 ICON "icon.ico"
1 ICON "about.ico"
2 ICON "quit.ico"
3 ICON "exit.ico"
4 ICON "exit_hover.ico"
5 ICON "help.ico"
I use the icons from this dll for all the ahk GUIs with no problem. I've only got issues with this function and it's counting results in occasional dlls.
Can someone help me out? I've attached my dll in a zip file.
All I'm trying to do here is to get a count of the number of icons in the dll....
Okay, so I figured this out:
This used to work - in ahk version 1.1.22.00 unicode 32-bit (of course, you didn't have LoadPicture() then - so you have to use the other code I have here:)
BUT, this same code does not work in hak 1.1.24 - for my dll (attached) it does not stop counting.
What used to work, worked in ahk, but with the advent of LoadPicture, I think something in ahk changed.
[Problem Understood (not resolved, but understood]
There was indeed a change in ahk with version 1.1.22.05: "Fixed icons which have non-numeric IDs loading with sub-optimal quality." And with this change, the code now rejects icons with an index of 0.
This is from the sourcecode for that version.
enum_data.result = -1; // Return value of -1 indicates failure, since ID 0 may be valid.` was changed to `enum_data.result = NULL; // Zero is probably not a valid integer ID; I think it would be compiled as "0" (string).
So, we see in the sourcecode that 0 is rejected as a valid index.
Now, what happens is that when we try to count the icons in the dll, ahk never stops counting. So I think we should fix ahk.