Jump to content
Sign in to follow this  

[Solved] Need help with bmp inside exe

Recommended Posts


Im having some problems putting a bmp image inside a compiled script. Or it's not a problem getting it in, it's more getting it out again without using fileinstall.

I have tried Zedna's UDF from here http://www.autoitscript.com/forum/index.php?showtopic=51103 but I cang get it to work.

I have this code in the beginning of my script

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_File_Add=bg.bmp, bitmap, BMP
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <String.au3>
#include "resources.au3"

Global Const $SF_UTF8 = 4
Global Const $SF_ANSI = 1

Global $xmlfile = @ScriptDir & "\feed.xml"

If NOT FileExists($xmlfile) Then
    InetGet("http://www.vivaldi.dk/feed/news/all/", $xmlfile, 1, 0)
    If @error <> 0 OR @InetGetBytesRead < 1024 Then
        Msgbox(0,"Error", "There was an error while downloading the feed. Check your Internet connection and try again!")
Global $Softwarename = "Name"
Global $Softwareversion = 1.00
Global $Title[6]
Global $Link[6]
Global $Text[6]
Global $Date[6]
Global $ColorLabel[6]
Global $Goto[7]
Global $Timer = TimerInit()
Global $Updatetimer = 600000
Global $Firstupdate = 540000
Global $Titel_Color = "0X8EA2CC" ; 778EBD   0XA20000   8EA2CC
Global $Text_Color = "0XEFEFEF"

#Region ### START Koda GUI section ### Form=
$Maingui = GUICreate($Softwarename, 488, 472, 193, 124)
$bg = GUICtrlCreatePic("bg.bmp", 0, 0, 488, 452)
GUICtrlSetState (-1, $GUI_DISABLE)

My background is called bg.bmp as you can see in the GUICtrlCreatePic. Can anyone help me how to add and extract that .bmp "inside" the exe

Edited by Hest

Software:Model Train Calculator (Screen)Autoit3 beginner!

Share this post

Link to post
Share on other sites


You really do need to read through the topic carefully and play with the examples before using Zedna's excellent UDF.

The #AutoIt3Wrapper_Res_File_Add directive no longer works with this UDF -(that is why it is struck out on the first page of the topic!). If you read the thread you will find out why. You should use ResHacker instead.

Also, if you had played with the examples you would have seen that you need to use a function from within the UDF to get the BMP into the picture control.

So, download ResHacker and change your directive to read:

#AutoIt3Wrapper_Run_After=Full_Path\ResHacker.exe -add %out%, %out%, bg.bmp, bitmap, BMP, 0

Then change the picture control generation code to read:

$bg = GUICtrlCreatePic("", 0, 0, 488, 452)
_ResourceSetImageToCtrl($bg, "BMP", $RT_BITMAP)
GUICtrlSetState ($bg, $GUI_DISABLE)

Zedna's UDF is an awesome piece of work - but as I said above, you really do need to read the whole topic and try out the examples before trying to use it for real.

Anyway - the code above works for me - come back if you still have problems. :D


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


Share this post

Link to post
Share on other sites

Thx alot, that helped. Didn't really think about the #AutoIt3Wrapper_Res_File_Add being struck out, but it's working now.

I will remove it definitely from my post :-)

I used it but later Autoit3Wrapper was changed and #AutoIt3Wrapper_Res_File_Add stopped working

because it places resources to wrong section with wrong name

so I reverted back to using reshacker.exe for adding resources.

Edited by Zedna

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.