Jump to content

list all files using _GUICtrlListView_AddItem


luis713
 Share

Recommended Posts

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
Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...