Jump to content

Recommended Posts

Posted (edited)

The Remarks on GuiCtrlSetImage state :

Use a resource hacker to know the value of the valid icon name in a file.

GUICtrlSetImage ( controlID, filename [, iconname [, icontype]] )

Like what?? I've downloaded and tried Reshack - but the .ico is not a valid exe or resource file - so no go there.

I opened the file with Gimp and the layers are named "Icon #1" through "Icon #4" - It has four icons in it and I've tried "Icon #4" and such - no good. I've tried "22", "24", etc... no good.

So, How do I know what "name" the icon I want from the .ico file is??

Global $heartbeat = GUICtrlCreateButton("",610,02,32,32,$BS_ICON)
GUICtrlSetImage($heartbeat,"redlight_hearts.ico","Icon #4")
; Icon #1 - yellow, Icon #2 - red, Icon #3 - green, Icon #4 - black
Edited by Graywalker
Posted (edited)

Try to use the ordinal (-5,-6 ...)

Or make a loop, to find the index:

Global $heartbeat = GUICtrlCreateButton("",610,02,32,32,$BS_ICON)
;GUICtrlSetImage($heartbeat,"redlight_hearts.ico",$i)
For $i=1 To 10;check the first ten indexes
GUICtrlSetImage($heartbeat,@ScriptDir&"\redlight_hearts.ico",$i)
Sleep(500);to see what's happen
Next

or use Koda (load the icon for the button and see there)

Edited by taietel
Posted

Well, I worked around it by:

Using Gimp to extract and save each icon to it's own .ico file.

Downloaded and installed IcoFX and used it's Resource Editor to add each .ico and save it as an .icl (Icon List) file.

Now :

GUICtrlSetImage($heartbeat, "BK_Set.icl", 1); Icon #1 - black, Icon #2 - green, Icon #3 - red, Icon #4 - yellow
works fine.

Apparently, the SetImage doesn't actually work with multiple Icon files - only .dll, .exe, .icl and other "resource" files to pull out the icon from those compiled sources.

So

GUICtrlSetImage($heartbeat, "heart_red.ico")
would work fine, but not
GUICtrlSetImage($heartbeat, "hearts_.ico",3)
- that would show the first icon in the .ico - or nothing.

To use multiple icons in one file you need a compiled resource.

With those, yes, a resource hacker would find the proper name for the icon I was seeking. Resource hackers do nothing on .ico files... lol!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...