Page 1 of 1

GUI add Image/Picture hard code

Posted: 17 Mar 2018, 06:33
by jmcall10
Hi,

I have the following code:

Code: Select all

Gui, Add, Picture, x0 y0 h68 w453, logo.png
Which works as far as adding the image to the GUI.

However when I move the exe file away from the directory or delete the logo.png file it wont appear on the GUI.

Obviously it is referencing the file rather than hard coding it into the GUI.

Is there a way to hard code the image into the GUI?

Apologies if this has been asked or is a simple question. I cannot seem to find a solution.

Regards,

jmcall10

Re: GUI add Image/Picture hard code

Posted: 17 Mar 2018, 06:48
by BoBo
You've to compile the script with the image file incorporated. As long as both are separate(d)/movable entities there's always a chance that link/reference gets broken.

Once a script is compiled, it becomes a standalone executable; that is, AutoHotkey.exe is not required in order to run the script. The compilation process creates an executable file which contains the following: the AutoHotkey interpreter, the script, any files it includes, and any files it has incorporated via the FileInstall command.

Re: GUI add Image/Picture hard code

Posted: 17 Mar 2018, 07:11
by noname
[v1.1.23+]: A bitmap or icon handle can be used instead of a filename. For example, HBITMAP:%handle%.
You can include the logo bitmap in the ahk code and use the hbitmap option to set it in the GUI.

https://autohotkey.com/board/topic/9329 ... r-scripts/