GUI add Image/Picture hard code

Get help with using AutoHotkey and its commands and hotkeys
jmcall10
Posts: 28
Joined: 25 Jan 2016, 21:27

GUI add Image/Picture hard code

17 Mar 2018, 06:33

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
BoBo
Posts: 2519
Joined: 13 May 2014, 17:15

Re: GUI add Image/Picture hard code

17 Mar 2018, 06:48

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.
User avatar
noname
Posts: 509
Joined: 19 Nov 2013, 09:15

Re: GUI add Image/Picture hard code

17 Mar 2018, 07:11

[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/
soundcloud.com/user-32706894

Return to “Ask For Help”

Who is online

Users browsing this forum: agrout, Azev, blad4, boiler, synnapt, teadrinker and 262 guests