Sign in to follow this  
Followers 0
Guest CBOB

include image file into executable ?

6 posts in this topic

Hi,

I use bitmaps to display this on buttons, like the follwoing code:

$backID = GUICtrlCreateButton ("Back", 0, 692, 142, 57, $BS_BITMAP)

GUICtrlSetImage (-1, "arrow-left.bmp")

After compiling the *.au3 to *.exe I must have the bitmap-File available on the client PC. Is there a possibility to compile / save / include the bitmap-File into the *.exe, that I have only one executable file to transfer to the destination system?

Tanks

CBOB

Share this post


Link to post
Share on other sites



I think the FileInstall function is what your looking for.

Regards

Share this post


Link to post
Share on other sites

mocro is correct. To go into a little more detail, the best way you can implement this is to FileInstall() the image into the user's Temp folder and use it from there, deleting it when you exit your script:

fileInstall("myBitmap.bmp", @tempDir & "\myBitmap.bmp")
guiCtrlCreatePic(@tempDir & "\myBitmap.bmp", 12, 12)
···
fileDelete(@tempDir & "\myBitmap.bmp")

Actually, if you only place the picture on your window once then you can get away with deleting the file immediately after the GUICtrlCreatePic(). The image will remain visible in your window until you delete the control or the window.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Another way to use it:

$1 = _TempFile()

FileInstall("test.jpg", $1)

...

$gui = GUICreate("Test", 500, 500, -1, -1,)
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")

...

$test = GUICtrlCreatePic($1, 25, 206, 169, 23)

...

Func Close()
     FileDelete($1)
EndFunc
Edited by JoshDB

Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite

Share this post


Link to post
Share on other sites

THANK YOU!

The function FileInstall() ist the solution. Now I can rollout only one compiled file.

Bye CBOB

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  
Followers 0