gonzo04 Posted July 20, 2013 Share Posted July 20, 2013 Hello guys, In my current attempt to make a list of several .bmp Files, I have hit a road block. Every time I add a new bmp from an array to the list with _GUIImageList_AddBitmap - it always adds the first one, even though the filename given to it is correct. (I checked.) If I use _GUIImageList_AddBitmap with plain text, directly hardcoding the path to the .bmp files, it works as expected. Is this a known bug? complete code: expandcollapse popup#include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> #RequireAdmin $folder = "X:\tesfiles" $CURRENTFOLDER = "X:\test" $NAME = "TEST" $CARDNAME = 1 global $filelist Global $file _Main() Func _Main() Global $listview, $hImage GUICreate("ImageList AddBitmap", 1020, 764) $listview = GUICtrlCreateListView("", 2, 2, 1016, 760, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($listview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER, $LVS_EX_CHECKBOXES)) GUISetState() ; Load images ;~ _GUIImageList_AddBitmap($hImage, $CURRENTFOLDER & "\" & "M14-2025.bmp") ;~ _GUICtrlListView_AddItem($listview, "Item 1", 0) ;~ _GUIImageList_AddBitmap($hImage, $CURRENTFOLDER & "\" & "M14-2056.bmp") ;~ _GUICtrlListView_AddItem($listview, "Item 2", 1) ;~ _GUIImageList_AddBitmap($hImage, $CURRENTFOLDER & "\" & "M17-1846.bmp") ;~ _GUICtrlListView_AddItem($listview, "Item 3", 2) call("ThumbList") $filelistarray = StringSplit($filelist, "|") $hImage = _GUIImageList_Create(128, 60) For $n = 1 to $filelistarray[0] $thumb = FileGetShortName($CURRENTFOLDER & "\" & $filelistarray[$n] & ".bmp") _GUIImageList_AddBitmap($hImage, $thumb) _GUICtrlListView_AddItem($listview, $filelistarray[$n], 0) MsgBox(64,"","added " & $filelistarray[$n] & ".bmp") next _GUICtrlListView_SetImageList($listview, $hImage, 1) ; Add columns _GUICtrlListView_AddColumn($listview, "Items", 400) ; Add items ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main Func ThumbList() Local $SEARCH = FileFindFirstFile($folder & "\*.RAW") If $SEARCH = -1 Then MsgBox(0, "Error", "No .RAW files found") Exit EndIf While 1 Local $file = FileFindNextFile($SEARCH) If @error Then ExitLoop $UHRZEIT = StringTrimRight($file, 4) $RUNBEFEHL = """" & @ScriptDir & "\raw2dng.exe" & """" & " " & '"' & $folder & "\" & $file & '"' & " " & '"' & $CURRENTFOLDER & "\" & $NAME & $CARDNAME & "_" & $UHRZEIT & "_" & '"';bereich 1 den ich geändert habe, dateinamen $PPM = $CURRENTFOLDER & "\" & $NAME & $CARDNAME & "_" & $UHRZEIT & "_" & "000000.ppm" ; bereich 2 geändert $RUNBEFEHLIVIEW = '"' & @ScriptDir & "\dcraw.exe" & '"' & " -w -H 2 " & '"' & $CURRENTFOLDER & "\" & $NAME & $CARDNAME & "_" & $UHRZEIT & "_" & "000000.dng" & '"'; bereich 2 geändert $RUNBEFEHLJPG = '"' & @ScriptDir & "\i_view32.exe" & '"' & " " & '"' & $PPM & '"' & " " & "/resize=(128,128) /aspectratio /resample /crop(0,0,128,128) /convert=" & '"' & $CURRENTFOLDER & "\" & $UHRZEIT & ".bmp" & '"' $tempfile = $CURRENTFOLDER & "\" & $NAME & $CARDNAME & "_" & $UHRZEIT & "_000001.dng" $raw2dng = Run($RUNBEFEHL, "", @SW_HIDE) Do if ProcessExists($raw2dng) then Sleep(5) Else ExitLoop EndIf Until FileExists($tempfile) ProcessClose($raw2dng) ProcessWaitClose($raw2dng) FileDelete($tempfile) runwait($RUNBEFEHLIVIEW,"",@SW_HIDE) RunWait($RUNBEFEHLJPG,"",@SW_HIDE) FileDelete($PPM) FileDelete($CURRENTFOLDER & "\" & $NAME & $CARDNAME & "_" & $UHRZEIT & "_" & "000000.dng") if $filelist = "" Then $filelist = StringTrimRight($FILE,4) Else $filelist = $filelist & "|" & StringTrimRight($FILE,4) EndIf ;~ _GUIImageList_AddBitmap($hImage, $CURRENTFOLDER & "\" & $UHRZEIT & ".bmp") ;~ InputBox("","",$CURRENTFOLDER & "\" & $UHRZEIT & ".bmp") ;~ _GUICtrlListView_AddItem($listview, $UHRZEIT, 0) WEnd EndFunc ;==>ThumbList Please help. Link to comment Share on other sites More sharing options...
Solution LarsJ Posted July 20, 2013 Solution Share Posted July 20, 2013 gonzo04, It's impossible to test your code so this is just a guess.Try to change these two lines in the For-loop:_GUIImageList_AddBitmap($hImage, $thumb) _GUICtrlListView_AddItem($listview, $filelistarray[$n], 0)To the following:$idx = _GUIImageList_AddBitmap($hImage, $thumb) _GUICtrlListView_AddItem($listview, $filelistarray[$n], $idx)There are no bugs in _GUIImageList_AddBitmap.Regards Lars. ravkr 1 Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
gonzo04 Posted July 20, 2013 Author Share Posted July 20, 2013 That did it! I am stunned. Can you elaborate how you knew? THANK YOU! Link to comment Share on other sites More sharing options...
LarsJ Posted July 21, 2013 Share Posted July 21, 2013 You are welcome. I knew it because I have read the help file. Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
gonzo04 Posted July 23, 2013 Author Share Posted July 23, 2013 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