Lupo73 Posted August 26, 2009 Posted August 26, 2009 (edited) I'm creating a function that, when called, add items in a listview. Items loaded are exe files and I'd like to add also the respective icon in the listview. I have some problems and I can't understand how to solve them. I made some tests, sometimes is shown the same icon for all items, sometimes only some icons for some items (but not all), sometimes no one icon is shown >_< This is the code.. someone can help me? expandcollapse popupFunc AppsFind($hListView, $hListViewH, $aDir, $type) Local $search, $folder, $attrib, $item, $ini, $hImage, $nn $hImage = _GUIImageList_Create() _GUICtrlListView_BeginUpdate($hListView) _GUICtrlListView_BeginUpdate($hListViewH) If FileExists($aDir) Then $search = FileFindFirstFile($aDir & "\*.*") While 1 $folder = FileFindNextFile($search) If @error Then ExitLoop $attrib = FileGetAttrib($aDir & "\" & $folder) If StringInStr($attrib, "D") Then $ini = $aDir & "\" & $folder & "\LupoApp.ini" If FileExists($ini) Then $nn = _GUIImageList_AddIcon($hImage, $aDir & "\" & $folder & "\" & IniRead($ini, "Software", "Main", "none.exe")) MsgBox(0x40000, $nn, $aDir & "\" & $folder & "\" & IniRead($ini, "Software", "Main", "none.exe")) $item = _GUICtrlListView_AddItem($hListView, IniRead($ini, "Software", "Name", $folder), $nn) _GUICtrlListView_AddSubItem($hListView, $item, IniRead($ini, "Software", "Version", " ? "), 1) _GUICtrlListView_AddSubItem($hListView, $item, " - ", 2) _GUICtrlListView_AddSubItem($hListView, $item, " - ", 3) _GUICtrlListView_AddSubItem($hListView, $item, $type, 4) $item = _GUICtrlListView_AddItem($hListViewH, $folder) ElseIf Not ($folder = "Extra") And Not ($folder = "Games") Then $nn = _GUIImageList_AddIcon($hImage, "Manager.exe") $item = _GUICtrlListView_AddItem($hListView, $folder, $nn) _GUICtrlListView_AddSubItem($hListView, $item, " ? ", 1) _GUICtrlListView_AddSubItem($hListView, $item, " - ", 2) _GUICtrlListView_AddSubItem($hListView, $item, " - ", 3) _GUICtrlListView_AddSubItem($hListView, $item, $type, 4) $item = _GUICtrlListView_AddItem($hListViewH, $folder) EndIf EndIf WEnd FileClose($search) EndIf _GUICtrlListView_EndUpdate($hListView) _GUICtrlListView_EndUpdate($hListViewH) _GUICtrlListView_SetImageList($hListView, $hImage, 1) EndFunc Edited August 26, 2009 by Lupo73 SFTPEx, AutoCompleteInput, _DateTimeStandard(), _ImageWriteResize(), _GUIGraduallyHide(): some AutoIt functions. Lupo PenSuite: all-in-one and completely free selection of portable programs and games. DropIt: a personal assistant to automatically manage your files. ArcThemALL!: application to multi-archive your files and folders.
Lupo73 Posted August 26, 2009 Author Posted August 26, 2009 Some hours of work and the bug is solved >_< ..yes, not so fast. Anyway, now remain only a minor problem: why all icons extracted has a black background? Can I remove it? Thanks! SFTPEx, AutoCompleteInput, _DateTimeStandard(), _ImageWriteResize(), _GUIGraduallyHide(): some AutoIt functions. Lupo PenSuite: all-in-one and completely free selection of portable programs and games. DropIt: a personal assistant to automatically manage your files. ArcThemALL!: application to multi-archive your files and folders.
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