Jump to content
Sign in to follow this  
luis713

list all files using _GUICtrlListView_AddItem

Recommended Posts

luis713

Hi, i have the code below, i think it should work but it's not working, i need list all the files and folders in c:test, and if it is possible show its icon for each file, can you give me a clue? i think the array should not be working because i can't learnt how to use arrays

#include 'guiconstantsex.au3'

#include 'guilistview.au3'

#include 'guiimagelist.au3'

#include 'array.au3'

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work



_Main()



Func _Main()

Local $hImage, $hListView



GUICreate("ListView Set Image List", 400, 300)

$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)

GUISetState()



; Load images

$hImage = _GUIImageList_Create()

_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))

_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))

_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))

Local $hPrevImageList = _GUICtrlListView_SetImageList($hListView, $hImage, 1)





; Add columns

_GUICtrlListView_AddColumn($hListView, "Column 1", 100)



Local $array[5]

Local $i = 1

$File = FileFindFirstFile("F:*")

_guictrllistview_additem($hListView, $file, $i)

For $i = 1 To $array[0]

$array = FileFindNextFile("F:*")

$array = + 1

$i = + 1

_guictrllistview_additem($hListView, $array, $i)

next



; Add items

_GUICtrlListView_AddItem($hListView, "Item 1", 0)

_GUICtrlListView_AddItem($hListView, "Item 2", 1)

_GUICtrlListView_AddItem($hListView, "Item 3", 2)





; Loop until user exits

Do

Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()

EndFunc ;==>_Main

Edited by luis713

Share this post


Link to post
Share on other sites
water

I haven't used any of this but on the fourm you'll find a lot of functions to do what you need.

is a thread which compares all/most of this functions.

One of the best seems to be Melba's RecFileListToArray.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
luis713

thanks, i hope find the code needed

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×