faustf Posted January 16, 2017 Share Posted January 16, 2017 hi guys i have a questions about how set image in lits view in a big script i have a port of it expandcollapse popupFunc _Popola_listview($sXML_Result_eBay, $hListview) If $sXML_Result_eBay[0] <> "False" Then Local $Count = _GUICtrlListView_GetItemCount($hListview) Local $c = 0 Local $h_Image = _GUIImageList_Create(32, 32) For $i = 0 To ((UBound($sXML_Result_eBay)) / 12) - 1 _GUICtrlListView_AddItem($hListview, $sXML_Result_eBay[$c], $Count) ; item id ;MsgBox(0,'4005',$sXML_Result_eBay[$c]) $c += 1 _GUICtrlListView_AddSubItem($hListview, $Count, $sXML_Result_eBay[$c], 1) ; Nome prodotto $c += 1 _GUICtrlListView_AddSubItem($hListview, $Count, $sXML_Result_eBay[$c], 2) ; qtt. $c += 1 Local $y $y = $c If $sXML_Result_eBay[$c] = "FixedPriceItem" Then $sXML_Result_eBay[$c] = "Compralo Subito" ElseIf $sXML_Result_eBay[$c] = "Chinese" Then $sXML_Result_eBay[$c] = "Asta" EndIf _GUICtrlListView_AddSubItem($hListview, $Count, $sXML_Result_eBay[$c], 3) ; formato $c += 1 If $sXML_Result_eBay[$y] = "Compralo Subito" Then _GUICtrlListView_AddSubItem($hListview, $Count, $sXML_Result_eBay[$c], 4) ; prezzo compralo subito EndIf $c += 1 If $sXML_Result_eBay[$y] = "Asta" Then _GUICtrlListView_AddSubItem($hListview, $Count, $sXML_Result_eBay[$c], 5) ; prezzo asta EndIf $c += 1 _GUICtrlListView_AddSubItem($hListview, $Count, $sXML_Result_eBay[$c], 6) ; prezzo spedizione $c += 1 _GUICtrlListView_AddSubItem($hListview, $Count, $sXML_Result_eBay[$c], 7) ; proposta d'acqusito $c += 1 _GUICtrlListView_AddSubItem($hListview, $Count, $sXML_Result_eBay[$c], 8) ; data apertura $c += 1 _GUICtrlListView_AddSubItem($hListview, $Count, $sXML_Result_eBay[$c], 9) ; tempo chiusura $c += 1 _GUICtrlListView_AddSubItem($hListview, $Count, $sXML_Result_eBay[$c], 10) ; url site $c += 1 Local $sFilePath = (@TempDir & "\" & $c & ".jpg") Local $hDownload = InetGet($sXML_Result_eBay[$c], $sFilePath, $INET_FORCERELOAD) _GDIPlus_Startup() Local $hImage = _GDIPlus_ImageLoadFromFile($sFilePath) Local $sCLSID = _GDIPlus_EncodersGetCLSID("BMP") _GDIPlus_ImageSaveToFileEx($hImage, @TempDir & "\" & $c & ".bmp", $sCLSID) Local $hImage = _GUIImageList_Create(11, 11) _GUIImageList_Add ($h_Image, _GUIImageList_AddBitmap($h_Image, @TempDir & "\" & $c & ".bmp")) _GUICtrlListView_SetImageList($hListview, $h_Image, 1) $c += 1 $Count += 1 Next _GDIPlus_Shutdown() Return $Count Else ;MsgBox(0,'','qui3734') MsgBox(48, $GUI_Lang[45], $GUI_Lang[133]) ; non ci sono prodotti in vendita EndIf EndFunc ;==>_Popola_listview this function populate a list view , if i call them only one time work perfect but if i insert in cicle (ex: for ) the item work perfect but image load and insert in first 4 product is possible , when insert a sub item insert also a foto ?? thankz Link to comment Share on other sites More sharing options...
faustf Posted January 17, 2017 Author Share Posted January 17, 2017 hi guys i try to understand how work a image bmp insert in listview , i have a part of script , and a complete script , in complete script work how i as expect, but in other script not compleate script worked expandcollapse popup#include <WinAPI.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <Constants.au3> #Include <WinAPI.au3> _Main() Func _Main() GUICreate("ImageList AddBitmap", 1000, 300) ; $listview = GUICtrlCreateListView("Items", 2, 2, 394, 268) Global $listview = _ListView_OK("", 8, 86, 1675, 274, "Item ID_150_Nome Prodotto_360_Qt._50_Formato_100_Prezzo C.S._100_Prezzo Asta_100_Prezzo Spedizione_100_Proposta d'acquisto_100_Data Apertura_100_Tempo Chiusura_100_Url Site_350") GUISetState() ; Load images $hImage = _GUIImageList_Create(32,32) _GUIImageList_AddBitmap($hImage, "C:\11.bmp") _GUICtrlListView_SetImageList($listview, $hImage, 1) ; Add items For $i=0 To 20 _GUICtrlListView_AddItem($listview, "Item 1", 0) _GUICtrlListView_AddSubItem($listview, $i, "Item 1add"&$i, 1) ; url site _GUICtrlListView_AddSubItem($listview, $i, "Item 1add"&$i, 2) ; url site _GUICtrlListView_AddSubItem($listview, $i, "Item 1add"&$i, 3) ; url site _GUICtrlListView_AddSubItem($listview, $i, "Item 1add"&$i, 4) ; url site _GUICtrlListView_AddSubItem($listview, $i, "Item 1add"&$i, 5) ; url site Next ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main Func _ListView_OK($text, $left, $top, $width, $height, $Column) Global $vName = GUICtrlCreateListView($text, $left, $top, $width, $height) _GUICtrlListView_SetExtendedListViewStyle($vName, BitOR($LVS_EX_INFOTIP, $LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES, $LVS_EX_SUBITEMIMAGES)) ; questa stringa fa la griglia stile excel Local $aColumn = StringSplit($Column, "_") For $i = 1 To UBound($aColumn) - 1 _GUICtrlListView_AddColumn($vName, $aColumn[$i], $aColumn[($i + 1)]) ; Utente fake $i += 1 Next Return $vName EndFunc ;==>_ListView_OK in all item appear a foto perfect expandcollapse popupFunc _prodotti_in_vendita_eBay() GUISwitch($hMainGUI, $SITIWEB_TabSheet1) ;_destroy_sitiweb_ship() GUICtrlDelete($SITIWEB_Combo4) GUICtrlDelete($SITIWEB_Button14) GUICtrlDelete($SITIWEB_Prod_in_vendita_list) ;_Inizializza_eBay_Param(GUICtrlRead($SITIWEB_Combo3)) Global $SITIWEB_Prod_in_vendita_list = _ListView_OK("", 8, 86, 1675, 274, "Item ID_150_Nome Prodotto_360_Qt._50_Formato_100_Prezzo C.S._100_Prezzo Asta_100_Prezzo Spedizione_100_Proposta d'acquisto_100_Data Apertura_100_Tempo Chiusura_100_Url Site_350") GUIRegisterMsg($WM_NOTIFY, "ordina_listview") ; funzione per ordinare le listview modificate Local $sTxtXmlResult = _eBay_list_Product("in vendita") _Popola_listview($sTxtXmlResult, $SITIWEB_Prod_in_vendita_list) ; funzione legata a _prodotti_in_vendita_eBay serve per poplare listview dall array estratto dal sito ebay ;_Popola_listview_con_Color($sTxtXmlResult, $SITIWEB_Prod_in_vendita_list) ; funzione legata a _prodotti_in_vendita_eBay serve per poplare listview dall array estratto dal sito ebay GUICtrlCreateTabItem("") ; <=========================== This line seems important for what u want doing EndFunc ;==>_prodotti_in_vendita_eBay Func _Popola_listview($sXML_Result_eBay, $hListview) ; funzione legata a _prodotti_in_vendita_eBay serve per poplare listview dall array estratto dal sito ebay If $sXML_Result_eBay[0] <> "False" Then Local $Count = _GUICtrlListView_GetItemCount($hListview) Local $c = 0 $hImage = _GUIImageList_Create(32,32) _GUIImageList_AddBitmap($hImage, "C:\11.bmp") _GUICtrlListView_SetImageList($hListview, $hImage, 1) ; Local $h_Image = _GUIImageList_Create(32, 32) For $i = 0 To ((UBound($sXML_Result_eBay)) / 12) - 1 _GUICtrlListView_AddItem($hListview, $sXML_Result_eBay[$c], $Count) ; item id ;MsgBox(0,'4005',$sXML_Result_eBay[$c]) $c += 1 _GUICtrlListView_AddSubItem($hListview, $Count, $sXML_Result_eBay[$c], 1) ; Nome prodotto $c += 1 _GUICtrlListView_AddSubItem($hListview, $Count, $sXML_Result_eBay[$c], 2) ; qtt. $c += 1 Local $y $y = $c If $sXML_Result_eBay[$c] = "FixedPriceItem" Then $sXML_Result_eBay[$c] = "Compralo Subito" ElseIf $sXML_Result_eBay[$c] = "Chinese" Then $sXML_Result_eBay[$c] = "Asta" EndIf _GUICtrlListView_AddSubItem($hListview, $Count, $sXML_Result_eBay[$c], 3) ; formato $c += 1 If $sXML_Result_eBay[$y] = "Compralo Subito" Then _GUICtrlListView_AddSubItem($hListview, $Count, $sXML_Result_eBay[$c], 4) ; prezzo compralo subito EndIf $c += 1 If $sXML_Result_eBay[$y] = "Asta" Then _GUICtrlListView_AddSubItem($hListview, $Count, $sXML_Result_eBay[$c], 5) ; prezzo asta EndIf $c += 1 _GUICtrlListView_AddSubItem($hListview, $Count, $sXML_Result_eBay[$c], 6) ; prezzo spedizione $c += 1 _GUICtrlListView_AddSubItem($hListview, $Count, $sXML_Result_eBay[$c], 7) ; proposta d'acqusito $c += 1 _GUICtrlListView_AddSubItem($hListview, $Count, $sXML_Result_eBay[$c], 8) ; data apertura $c += 1 _GUICtrlListView_AddSubItem($hListview, $Count, $sXML_Result_eBay[$c], 9) ; tempo chiusura $c += 1 _GUICtrlListView_AddSubItem($hListview, $Count, $sXML_Result_eBay[$c], 10) ; url site $c += 1 #cs Local $sFilePath = (@TempDir & "\" & $c & ".jpg") Local $hDownload = InetGet($sXML_Result_eBay[$c], $sFilePath, $INET_FORCERELOAD) _GDIPlus_Startup() Local $hImage = _GDIPlus_ImageLoadFromFile($sFilePath) Local $sCLSID = _GDIPlus_EncodersGetCLSID("BMP") _GDIPlus_ImageSaveToFileEx($hImage, @TempDir & "\" & $c & ".bmp", $sCLSID) _GUIImageList_AddBitmap($h_Image, @TempDir & "\" & $c & ".bmp") #ce $c += 1 $Count += 1 Next ;_GUICtrlListView_SetImageList($hListview, $h_Image, 1) ;_GDIPlus_Shutdown() Return $Count Else ;MsgBox(0,'','qui3734') MsgBox(48, $GUI_Lang[45], $GUI_Lang[133]) ; non ci sono prodotti in vendita EndIf EndFunc ;==>_Popola_listview in this part of script when execute appear foto only in first line , the script publish for all items the foto but put it always in first item , i think someone have idea?? thankz at all Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 17, 2017 Moderators Share Posted January 17, 2017 @faustf How is this topic any different than this one? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
faustf Posted January 17, 2017 Author Share Posted January 17, 2017 sorry , (also if have some differents) , but if you want could erase this post , and i upgrade old post , thankz again Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 17, 2017 Moderators Share Posted January 17, 2017 Threads merged. You have been on this forum for 5 years now; I think that is long enough for you to have more common sense than double posting rather than just modifying your thread. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! 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