Search the Community
Showing results for tags 'iconimage.au3'.
-
Dear all, I got a problem of Iconimage.au3 UDF. I want to write a File browser, so i used a Icon style listview control, with the help of iconimage UDF, it's very convenient。 but please check my sample scipt, when i press F3 hotkey quickly, why there is different listview item count on listview control ? Thanks for your reply, ZQY #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include "IconImage.au3" #include "Binary.au3" Opt("GUIOnEventMode",1) Global $w = 128,$h = 128 Global $hGUI = GUICreate("Example", 1500, 900) GUISetOnEvent($GUI_EVENT_CLOSE,"_exit") Global $g_hListView = GUICtrlCreateListView('', 2, 10, 1494, 868) _GUICtrlListView_SetView($g_hListView,0) ;_GUICtrlListView_SetIconSpacing($g_hListView,200,200) Global $hImage = _GUIImageList_Create($w,$h,5) _GUICtrlListView_SetImageList($g_hListView, $hImage, 0) _WinAPI_GetDefineWH_IconFromFile($g_hListView,$hImage,"D:\....\excel.xlsx",$w,$h) ; define file fullpath _WinAPI_GetDefineWH_IconFromFile($g_hListView,$hImage,"D:\....\coreldra.cdr",$w,$h) ; define file fullpath GUISetState(@SW_SHOW, $hGUI) HotKeySet("{F3}","test") ; press F3 quickly , difference item coult in listview control Func _exit() Exit EndFunc While 1 Sleep(1000) WEnd Func test() _GUIImageList_Remove($hImage,-1) _GUICtrlListView_DeleteAllItems($g_hListView) _WinAPI_GetDefineWH_IconFromFile($g_hListView,$hImage,"D:\....\excel.xlsx",$w,$h) ;Press add more file here _WinAPI_GetDefineWH_IconFromFile($g_hListView,$hImage,"D:\....\excel.xlsx",$w,$h) _WinAPI_GetDefineWH_IconFromFile($g_hListView,$hImage,"D:\....\excel.xlsx",$w,$h) _WinAPI_GetDefineWH_IconFromFile($g_hListView,$hImage,"D:\....\excel.xlsx",$w,$h) _WinAPI_GetDefineWH_IconFromFile($g_hListView,$hImage,"D:\....\excel.xlsx",$w,$h) _WinAPI_GetDefineWH_IconFromFile($g_hListView,$hImage,"D:\....\excel.xlsx",$w,$h) _WinAPI_GetDefineWH_IconFromFile($g_hListView,$hImage,"D:\....\excel.xlsx",$w,$h) _WinAPI_GetDefineWH_IconFromFile($g_hListView,$hImage,"D:\....\excel.xlsx",$w,$h) EndFunc Func _WinAPI_GetDefineWH_IconFromFile($iLVCtrlID,$hImageList,$iFile,$iIconW,$iIconH) _IconImage_Startup() Local $iIconImage,$iIconScale,$hIcon ;#cs Switch _WinAPI_PathFindExtension($iFile) Case ".png",".jpg",".bmp",".tif",".gif",".tiff" $iIconImage = _IconImage_FromImageFile($iFile) Case Else $iIconImage = _IconImage_FromPath($iFile,$iIconW,$iIconH) ;$iIconImage = _WinAPI_ShellExtractAssociatedIcon($iFile,False) EndSwitch ;#ce ;$iIconImage = _WinAPI_ShellExtractAssociatedIcon($iFile,False) $iIconScale = _IconImage_Scale($iIconImage,$iIconW,$iIconH,$GDIP_ModeHighQuality) $hIcon = _IconImage_ToHandle($iIconScale,$iIconW,$iIconH) Local $Index = _GUIImageList_ReplaceIcon($hImageList, -1, $hIcon) Local $icount = _GUICtrlListView_GetItemCount($iLVCtrlID)+1 _GUICtrlListView_AddItem($iLVCtrlID, "Item"&$icount, $Index) _WinAPI_DestroyIcon($hIcon) _IconImage_Shutdown() EndFunc TestScript.rar