Is it possible to search the hard drive for picture files, and list the results in a list box.
Thanks
;) Mark_Dep :)
:P
Printable View
Is it possible to search the hard drive for picture files, and list the results in a list box.
Thanks
;) Mark_Dep :)
:P
I'm just modifying my code, i had in an usercontrol for your purpose, i haven't tested it yet, try it:
Code:Public filemax
Public diremax
Public tid
Sub explore(startdir As String, Optional pauses = 100)
filemax = 0: diremax = 0: Totalb = 0: curlevel = 0
If Right(startdir, 1) <> "\" Then startdir = startdir & "\"
ListSubDirs startdir, pauses
tid = Timer - tids
End Sub
Sub ListSubDirs(path As String, pauses)
Dim i, dmax, dirname As String, dire() As String
dirname = Dir(path, 63)
Do While dirname <> ""
If dirname <> "." And dirname <> ".." Then
If Int(GetAttr(path + dirname) / 16) Mod 2 = 1 Then
If (dmax Mod 10) = 0 Then
ReDim Preserve dire(dmax + 10)
End If
diremax = diremax + 1: dmax = dmax + 1
dire(dmax) = dirname
Else
filemax = filemax + 1
If path Like "*.jpg" Or dirname Like "*.gif" Or dirname Like "*.bmp" Then list1.AddItem path & direname
End If
End If
dirname = Dir
waiter = waiter + 1: If waiter Mod (pauses) = 1 Then DoEvents
Loop
For i = 1 To dmax
ListSubDirs path & dire(i) & "\", pauses
Next i
End Sub