Darkbeo Posted January 14, 2010 Share Posted January 14, 2010 Hi everyone, After a long time, I'm coming to use AutoIt. I do not remember almost nothing about, I wonder how I can use icons "on.ico" and "off.ico" in a GUICtrlCreatePic or to change GUISetIcon? Script: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=icons\mouse.ico #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_Res_Icon_Add=icons\on.ico #AutoIt3Wrapper_Res_Icon_Add=icons\off.ico #AutoIt3Wrapper_Res_File_Add=images\mouse.jpg, RT_RCDATA, 0_JPG_1, 0 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Project01", 118, 120, 302, 218) GUISetIcon("icons\project.ico") $Pic1 = GUICtrlCreatePic("", 8, 8, 100, 100, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Link to comment Share on other sites More sharing options...
Darkbeo Posted January 14, 2010 Author Share Posted January 14, 2010 I registered here in the forum for a long time since I've used the AutoIt in 2007 for a short period of time and then had to stop using to give priority to work and study. I am wanting to start using AutoIt, but I have forgotten a lot of things, I wonder if someone could help me with this I have little doubt that it: How do I use the files added to the executable from the command line #AutoIt3Wrapper_Run_After=ResHacker\ResHacker.exe -add %out%, %out%, images\img01.jpg, RT_RCDATA, IMG_JPG_0, 0 #AutoIt3Wrapper_Run_After=ResHacker\ResHacker.exe -add %out%, %out%, images\img02.jpg, RT_RCDATA, IMG_JPG_1, 0 therefore necessary to use these images in such GUICtrlCreatePic to start implementing the GUICtrlCreatePic will have the image "Image1.bmp" standard, after the User clicks a button the image will be changed to "image2.bmp" Could anyone help me? Thank you for your attention Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 14, 2010 Moderators Share Posted January 14, 2010 Darkbeo,Welcome back to the AutoIt forum! Q1. When I use #AutoIt3Wrapper_Res_Icon_Add the first added icon is added at index -5. So if you declare something like this:Global Const $iOn_Icon = -5, $iOff_Icon = -6then you can use this as syntax:TraySetIcon(@ScriptFullPath, $iOn_Icon) ; or $hFred = GUICtrlCreateButton("", 243, 8, 24, 24, $BS_ICON) GUICtrlSetImage($hFred, @ScriptFullPath, $iOff_Icon, 0)Q2. The easiest way to use added resources within the .exe is Zedna's excellent Resources UDF, which you can find here. But you MUST read the topic carefully and play with the examples until you understand what is going on. The UDF is not difficult, but if you do not get the syntax right you might as well not bother!I hope this helps. Please ask if anything is unclear. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Darkbeo Posted January 15, 2010 Author Share Posted January 15, 2010 Darkbeo, Welcome back to the AutoIt forum! Q1. When I use #AutoIt3Wrapper_Res_Icon_Add the first added icon is added at index -5. So if you declare something like this: Global Const $iOn_Icon = -5, $iOff_Icon = -6 then you can use this as syntax: TraySetIcon(@ScriptFullPath, $iOn_Icon) ; or $hFred = GUICtrlCreateButton("", 243, 8, 24, 24, $BS_ICON) GUICtrlSetImage($hFred, @ScriptFullPath, $iOff_Icon, 0) Q2. The easiest way to use added resources within the .exe is Zedna's excellent Resources UDF, which you can find here. But you MUST read the topic carefully and play with the examples until you understand what is going on. The UDF is not difficult, but if you do not get the syntax right you might as well not bother! I hope this helps. Please ask if anything is unclear. M23 Thanks for the help. 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