botanic Posted February 19, 2008 Share Posted February 19, 2008 I want to add icons like in the helpfiles _GUICtrlComboBoxEx_GetCurSel I know i will need winapi just I dont quite know how to work it -.- expandcollapse popup#include <C:\Program Files\AutoIt3\Include\GUIConstants.au3> #include <C:\Program Files\AutoIt3\Include\GuiComboBoxEx.au3> #include <C:\Program Files\AutoIt3\Include\GuiImageList.au3> #Include <C:\Program Files\AutoIt3\Include\String.au3> #Include <C:\Program Files\AutoIt3\Include\WinAPI.au3> global $1, $call, $ini, $file, $hGUI, $tmp, $iIndex $file = "C:\Documents and Settings\Matthew\My Documents\My Games\Gamelist.ini" func _run() Local $hGUI, $hImage, $hCombo, $tmm $tmp = "" ; Create GUI $hGUI = GUICreate("Games", 400, 130) $b1 = GUICtrlCreateButton("Run Game",5,103) $b2 = GUICtrlCreateButton("Add/Edit Game",70,103) $b3 = GUICtrlCreateButton("Remove Game",155, 103) $hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100, BitOR($CBS_SIMPLE, $WS_VSCROLL, $WS_BORDER)) GUISetState() $ini = IniReadSectionNames($file) if $ini <> @error then For $1 = 1 to $ini[0] _GUICtrlComboBoxex_AddString ($hCombo, $ini[$1]) Next EndIf While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $b1 $tmp = _GUICtrlComboBoxEx_GetCurSel($hCombo) $tmp = IniRead($file, $ini[$tmp+1], "Path","") Run($tmp) Exit Case $msg = $b2 $tmp = _GUICtrlComboBoxEx_GetCurSel($hCombo) $ini = IniReadSectionNames($file) if $ini <> @error then $tmp = IniRead($file, $ini[$tmp+1], "Path","") Else $tmp = "" EndIf GUIDelete($hGUI) _add($tmp) Case $msg = $b3 $tmp = _GUICtrlComboBoxEx_GetCurSel($hCombo) IniWriteSection($file, $ini[$tmp+1], "") IniDelete($file, $ini[$tmp+1]) GUIDelete($hGUI) _run() EndSelect Wend EndFunc func _choose($xxxxc) if $xxxxc = "" Then $var = FileOpenDialog("Browse for the EXE", @DesktopDir, "Executable (*.exe)", 1 ) if @error Then Else $tmp = StringSplit(_StringReverse(StringTrimRight(FileGetLongName($var,1),4)),"\") $tmp = InputBox("Game Name", "Please type the game name", _StringReverse($tmp[1])) IniWrite($file,$tmp,"Path", $var) EndIf Else $var = FileOpenDialog("Browse for the EXE", $xxxxc, "Executable (*.exe)", 1 ) if @error Then Else $tmp = StringSplit(_StringReverse(StringTrimRight(FileGetLongName($var,1),4)),"\") $tmp = InputBox("Game Name", "Please type the game name", _StringReverse($tmp[1])) IniWrite($file,$tmp,"Path", $var) IniWriteSection($file, $ini[$tmp+1], "") IniDelete($file, $ini[$tmp+1]) EndIf EndIf _run() EndFunc func _add($tmp) local $file2, $tpm, $tmpp, $xxxxc, $ink , $ico $xxxc = GUICreate("Add a game", 300,60, @DesktopWidth/2-160, @DesktopHeight/2-45, -1, $WS_EX_ACCEPTFILES); WS_EX_ACCEPTFILES $var = GUICtrlCreateInput ( $tmp, 10, 5, 220, 20) GUICtrlSetState(-1,$GUI_DROPACCEPTED) $btn = GUICtrlCreateButton ("Browse", 230, 5, 60, 20) $ok = GUICtrlCreateButton ("Add", 10, 35, 60, 20) $ccl = GUICtrlCreateButton ("Cancel", 75, 35, 60, 20) GUISetState () $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn GUIDelete($hGUI) _choose($tmp) Case $msg = $ok $var = GUICtrlRead($var) if $var = "" or $var = " " then MsgBox(0, "Opps!", "This cannot be blank") exitloop Else $ink = FileGetShortcut($var) if @error <> 1 then $var = $ink[0] $tmpp = StringSplit(_StringReverse(StringTrimRight(FileGetLongName($var,1),4)),"\") $tmpp = InputBox("Game Name", "Please type the game name", _StringReverse($tmpp[1])) IniWrite($file,$tmpp,"Path", $var) if $tmp <> $tmpp and $tmp <> "" Then IniWriteSection($file, $ini[$tmp+1], "") IniDelete($file, $ini[$tmp+1]) EndIf exitloop EndIf Case $msg = $ccl exitloop EndSelect Wend GUIDelete($hGUI) _run() EndFunc _run() Link to comment Share on other sites More sharing options...
MrCreatoR Posted February 19, 2008 Share Posted February 19, 2008 I want to add iconsExample from the help file: expandcollapse popup#include <GuiComboBoxEx.au3> #include <GuiImageList.au3> Opt('MustDeclareVars', 1) $Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work _Main() Func _Main() Local $hGUI, $hImage, $hCombo ; Create GUI $hGUI = GUICreate("ComboBoxEx Add String", 400, 300) $hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100) GUISetState() $hImage = _GUIImageList_Create (16, 16, 5, 3) For $x = 0 To 146 _GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", $x) Next _GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16)) _GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16)) _GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16)) _GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage) _GUICtrlComboBoxEx_InitStorage ($hCombo, 150, 300) _GUICtrlComboBoxEx_BeginUpdate ($hCombo) For $x = 0 To 149 _GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 200, 1)), $x, $x) Next _GUICtrlComboBoxEx_EndUpdate ($hCombo) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>_Main Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
botanic Posted February 20, 2008 Author Share Posted February 20, 2008 I dont wuite get how that works ;/ but my main problem is with linking that to the winapi commands just the image thing i can figure out iven enough time its the 2 problems together that have me stumped Link to comment Share on other sites More sharing options...
Zedna Posted February 20, 2008 Share Posted February 20, 2008 Example from the help file:...Little note: This example works OK on WINXP but doesn't work on WIN98. Resources UDF ResourcesEx UDF AutoIt Forum Search 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