Jump to content

Help with embedding bmp into exe


shea851
 Share

Recommended Posts

Using the UDF from http://www.autoitscript.com/forum/index.ph...45&start=45

Unsure if I have to use the UDF or if there is an easier way to do it?

Anyways.. it doesn't work.. here's my code.. please help if anyone can! Thanks!

#include <GUIConstants.au3>
#include <resources.au3>

#AutoIt3Wrapper_Res_File_Add=wordfoldergrey.bmp, bitmap, TEST_BMP_1
#AutoIt3Wrapper_Res_File_Add=xfoldergrey.bmp, bitmap, TEST_BMP_2
#AutoIt3Wrapper_Res_File_Add=iefoldergrey.bmp, bitmap, TEST_BMP_3

$Bmp1 = _ResourceGet("TEST_BMP_1", $RT_BITMAP)
$Bmp2 = _ResourceGet("TEST_BMP_2", $RT_BITMAP)
$Bmp3 = _ResourceGet("TEST_BMP_3", $RT_BITMAP)

#Region ### START Koda GUI section ### Form=H:\Koda\Forms\test3.kxf
$Form1_1_1 = GUICreate(" .doc -> .html -> .chm", 449, 394, 221, 161)
GUISetFont(8, 400, 0, "Tahoma")
$Group1 = GUICtrlCreateGroup(".doc files to be converted:  ", 0, 8, 448, 185)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")
$List1 = GUICtrlCreateList("", 7, 31, 393, 121, $LBS_SORT)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")
$FileAddDialogueDOC = GUICtrlCreateButton("(Not allowed)", 405, 31, 36, 36, $BS_BITMAP)
;GUICtrlSetImage($FileAddDialogueDOC, "wordfoldergrey.bmp")
GUICtrlSetImage($FileAddDialogueDOC, $Bmp1)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")
$FileRemoveDialogueDOC = GUICtrlCreateButton("(Not allowed)", 405, 71, 36, 36, $BS_BITMAP)
;GUICtrlSetImage($FileRemoveDialogueDOC, "xfoldergrey.bmp")
GUICtrlSetImage($FileRemoveDialogueDOC, $Bmp2)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")
$ConvertToHTML = GUICtrlCreateButton("Convert to HTML", 7, 157, 97, 29, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup(".html documents to be imported: ", 0, 208, 448, 185)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")
$List2 = GUICtrlCreateList("", 7, 231, 393, 121, $LBS_SORT)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")
$FileAddDialogueHTML = GUICtrlCreateButton("(Not allowed)", 405, 231, 36, 36, $BS_BITMAP)
;GUICtrlSetImage($FileAddDialogueHTML, "iefoldergrey.bmp")
GUICtrlSetImage($FileAddDialogueHTML, $Bmp3)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")
$FileRemoveDialogueHTML = GUICtrlCreateButton("(Not allowed)", 405, 271, 36, 36, $BS_BITMAP)
;GUICtrlSetImage($FileRemoveDialogueHTML, "xfoldergrey.bmp")
GUICtrlSetImage($FileRemoveDialogueHTML, $Bmp2)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")
$ImportToCHM = GUICtrlCreateButton("Import to CHM", 7, 357, 97, 29, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")
GUICtrlSetState(-1, $GUI_DISABLE)
$CompileCHM = GUICtrlCreateButton("Compile CHM", 111, 357, 97, 29, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Link to comment
Share on other sites

You can post in my topic next time :-)

Use _ResourceSetImageToCtrl()

...
$FileAddDialogueDOC = GUICtrlCreateButton("(Not allowed)", 405, 31, 36, 36, $BS_BITMAP)
;GUICtrlSetImage($FileAddDialogueDOC, "wordfoldergrey.bmp")
;GUICtrlSetImage($FileAddDialogueDOC, $Bmp1)
_ResourceSetImageToCtrl($FileAddDialogueDOC, "TEST_BMP_1", $RT_BITMAP)
...

In my example I used also _ResourceGet() only for demonstration reason. _ResourceSetImageToCtrl() is better way for images.

Link to comment
Share on other sites

Ugh, this GUI stuff is so confusing to me.....

Still doesn't work, the buttons are completely blank. Any ideas?

#include <GUIConstants.au3>
#include <resources.au3>

#AutoIt3Wrapper_Res_File_Add=wordfoldergrey.bmp, bitmap, TEST_BMP_1
#AutoIt3Wrapper_Res_File_Add=xfoldergrey.bmp, bitmap, TEST_BMP_2
#AutoIt3Wrapper_Res_File_Add=iefoldergrey.bmp, bitmap, TEST_BMP_3

#Region ### START Koda GUI section ### Form=H:\Koda\Forms\test3.kxf

$Form1_1_1 = GUICreate(" .doc -> .html -> .chm", 449, 394, 221, 161)
GUISetFont(8, 400, 0, "Tahoma")

$Group1 = GUICtrlCreateGroup(".doc files to be converted:  ", 0, 8, 448, 185)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")

$List1 = GUICtrlCreateList("", 7, 31, 393, 121, $LBS_SORT)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")

$FileAddDialogueDOC = GUICtrlCreateButton("(Not allowed)", 405, 31, 36, 36, $BS_BITMAP)
_ResourceSetImageToCtrl($FileAddDialogueDOC, "TEST_BMP_1", $RT_BITMAP)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")

$FileRemoveDialogueDOC = GUICtrlCreateButton("(Not allowed)", 405, 71, 36, 36, $BS_BITMAP)
;GUICtrlSetImage($FileRemoveDialogueDOC, "xfoldergrey.bmp")
;GUICtrlSetImage($FileRemoveDialogueDOC, $Bmp2)
_ResourceSetImageToCtrl($FileRemoveDialogueDOC, "TEST_BMP_2", $RT_BITMAP)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")

$ConvertToHTML = GUICtrlCreateButton("Convert to HTML", 7, 157, 97, 29, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group2 = GUICtrlCreateGroup(".html documents to be imported: ", 0, 208, 448, 185)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")

$List2 = GUICtrlCreateList("", 7, 231, 393, 121, $LBS_SORT)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")

$FileAddDialogueHTML = GUICtrlCreateButton("(Not allowed)", 405, 231, 36, 36, $BS_BITMAP)
;GUICtrlSetImage($FileAddDialogueHTML, "iefoldergrey.bmp")
;GUICtrlSetImage($FileAddDialogueHTML, $Bmp3)
_ResourceSetImageToCtrl($FileAddDialogueHTML, "TEST_BMP_3", $RT_BITMAP)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")

$FileRemoveDialogueHTML = GUICtrlCreateButton("(Not allowed)", 405, 271, 36, 36, $BS_BITMAP)
;GUICtrlSetImage($FileRemoveDialogueHTML, "xfoldergrey.bmp")
;GUICtrlSetImage($FileRemoveDialogueHTML, $Bmp2)
_ResourceSetImageToCtrl($FileRemoveDialogueHTML, "TEST_BMP_2", $RT_BITMAP)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")

$ImportToCHM = GUICtrlCreateButton("Import to CHM", 7, 357, 97, 29, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")
GUICtrlSetState(-1, $GUI_DISABLE)

$CompileCHM = GUICtrlCreateButton("Compile CHM", 111, 357, 97, 29, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###
Link to comment
Share on other sites

STM_SETIMAGE which I'm using works only with "static controls" - see MSDN for details.

So my example for picture control works fine but for button and label it's really not working.

Till this will be resolved (if ever) you may use FileInstall() & GUICtrlSetImage() for your buttons.

Edited by Zedna
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...