aymhenry Posted November 22, 2010 Share Posted November 22, 2010 (edited) I’ve made a lot of trails to load custom icons to toolbar.My aim is to include the icons in the same exe file. The result is blank square in icon place Here is the code:- #AutoIt3Wrapper_Res_Icon_Add=ICO_00.ICO #AutoIt3Wrapper_Res_Icon_Add=ICO_01.ICO #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiToolBar.au3> Opt('MustDeclareVars', 1) _Main() Func _Main() Global Enum $idNew = 1000, $idOpen Local $hGUI, $hToolbar, $hNormal Local $hGUI = GUICreate("Toolbar", 400, 300) Local $hToolbar = _GUICtrlToolbar_Create($hGUI) _GUICtrlToolbar_AddBitmap($hGUI, 1, @ScriptFullPath, -5) _GUICtrlToolbar_AddButton($hToolbar, $idNew, 0) _GUICtrlToolbar_AddButton($hToolbar, $idOpen, 1) GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>_Main Any idea for help Edited November 22, 2010 by aymhenry Link to comment Share on other sites More sharing options...
Mat Posted November 22, 2010 Share Posted November 22, 2010 (edited) Off the top of my head I would use an image list... himglist = _GUIImageList_Create i = _GUIImageList_AddIcon (you can use @ScriptFullPath for this) ... Add all the icons to the image list _GUICtrlToolbar_SetImageList _GUICtrlToolbar_AddButton (i is the image index) ... Add all the buttons Of course, the right way to do it is have a bitmap strip, and have a mask as well (or make sure you have a good background colour so you can make that transparent). I remember looking at this a while ago, so I'll have to dig up some old code for you One thing that I do recommend is having a way that works both uncompiled and compiled. Usually that means using a dummy exe or dll with the resources (I have an empty template dll that I re use, adding the resources using reshacker). That way you won't have to go through the job of compiling just to test. Mat Edit: Just to make doubly sure... You do know a strip is the best way to go about this, try using reshacker on Wordpad for an example (usually in C:\Program Files\Windows NT\Accessories\Wordpad). Edited November 22, 2010 by Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
aymhenry Posted November 23, 2010 Author Share Posted November 23, 2010 Thank you for your support. I've read your idea, the problem is solved. The question now, why _GUICtrlToolbar_AddBitmap is not working? Is it a bug? Link to comment Share on other sites More sharing options...
Mat Posted November 23, 2010 Share Posted November 23, 2010 I assume an icon not being a bitmap is the problem... I think there are ways to convert between the two, but I'm not the person to ask about that. Glad to hear it's solved though AutoIt Project Listing Link to comment Share on other sites More sharing options...
aymhenry Posted November 25, 2010 Author Share Posted November 25, 2010 I assume an icon not being a bitmap is the problem... I think there are ways to convert between the two, but I'm not the person to ask about that.Glad to hear it's solved though Yes, there are ways to convert between the two Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now