Jump to content

How to Add icon file in .exe


Recommended Posts

How to add icons to the EXE

In my source is:

Icon1 GUICtrlCreateIcon = $ ("Red.ico", -1, 24, 216, 24, 24)

But only appears if the file is in the same directory as the exe.

I tried to add Res files at compile time but without success:

C:Documents and SettingsAdministratorDesktopRed.ico

in script:

#AutoIt3Wrapper_Res_Icon_Add=C:Documents and SettingsAdministradorDesktopRed.ico

remembering, it works perfectly if ico files are in the same folder

Note: The Icon is not what appears in the exe, but that appears at the bottom of my form

Edited by GordonFreeman
Link to comment
Share on other sites

Try adding quotes around the filename/path statement, there are spaces in it that might be throwing it off.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Documents(here?) and(here?) Settings

i try:

#AutoIt3Wrapper_Res_Icon_Add=E:Red.ico

#AutoIt3Wrapper_Res_Icon_Add=E:Green.ico

In example of autoit:

; Example 1

#AutoIt3Wrapper_Res_Icon_Add=C:Program FilesAutoIt3Iconsau3.ico

#AutoIt3Wrapper_Res_Icon_Add=C:Program FilesAutoIt3Iconsfiletype1.ico

#AutoIt3Wrapper_Res_Icon_Add=C:Program FilesAutoIt3Iconsfiletype2.ico

#AutoIt3Wrapper_Res_Icon_Add=C:Program FilesAutoIt3Iconsfiletype3.ico

#AutoIt3Wrapper_Res_Icon_Add=C:Program FilesAutoIt3Iconsfiletype-blank.ico

So the problem must lie in what I call my icon.

I am calling like he was in the directory,

$Icon1 = GUICtrlCreateIcon("Red.ico", -1, 24, 216, 24, 24)

Is there another way to call him him being included in the exe?

Edited by GordonFreeman
Link to comment
Share on other sites

If you are trying to use the icon in that function, you can't refer to it by it's filename because it isn't in your script directory, it's embedded in your exe file. You have to use your script name as the source @ScriptFullPath and a reference to the icon in it. Look at this page for an example of how to use an embedded icon.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
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
 Share

  • Recently Browsing   0 members

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