Jump to content
Sign in to follow this  

Having problems with embedding .ico-Files

Recommended Posts


Hey there,

im new to AutoIt and trying to do something, which has been asked houndred times. But as I already know how it should work, I don't know how it actually does.

I tried using the following example script directly from the AutoIt-site, but for now to no avail. The script should embed some icons and show them on a button, but it doesn't. Using ResourceHacker I as well don't find any additional resources. The only way to find an icon in a compiled .exe afterwards is to define the custom icon in Aut2Exe.

Adding Extra Ico's to the program resources (LINK)

#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files (x86)\AutoIt3\Icons\au3.ico
#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files (x86)\AutoIt3\Icons\filetype1.ico
#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files (x86)\AutoIt3\Icons\filetype2.ico
#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files (x86)\AutoIt3\Icons\filetype3.ico
#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files (x86)\AutoIt3\Icons\filetype-blank.ico
#include <GUIConstants.au3>
GUICreate("Demo resource ICO's")
$h_Button1 = GUICtrlCreateButton("my picture button", 10, 20, 40, 40, $BS_ICON)
For $x = 0 To 7
   $rc = TraySetIcon(@ScriptFullPath, -$x)
   $rc2 = GUICtrlSetImage($h_Button1, @ScriptFullPath, -$x)
   If $x < 3 Then
      TrayTip("Default ico:" & $x, "TraySetIcon rc:" & $rc & @LF & "GUICtrlSetImage rc:" & $rc2, 3)
      TrayTip("New ico:" & $x, "TraySetIcon rc:" & $rc & @LF & "GUICtrlSetImage rc:" & $rc2, 3)

As you may have noticed I am on a Windows XP x64 Pro machine. That's why i altered the folders.

All icons are accessible and work 100% fine when im copypasting the files' location to the explorer.

For now I have no clue what I'm doing wrong. I don't think it has to do with compatibility problems though, since I as well tested the script on a WinXP x86 system.



Edited by amaasbier

Share this post

Link to post
Share on other sites

I noticed that the sample GUI (SampleControls.au3) doesn't compile correctly. There never is any icon displayed, but the sample avi and gif works fine.

Accessing the compiler via rightclick menu, Au2Exe or from within SciTe doesn't seem to make a difference. Not even x86/x64 mode. :)

I always end up with the same result:


Share this post

Link to post
Share on other sites

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
Sign in to follow this