|
-
Jun 25th, 2003, 02:35 PM
#1
Thread Starter
Fanatic Member
What is the most efficient way to list files/folders in a directory?
and determine if theyre a file or a folder?
by most efficeint, i mean fastest with least ram needed (so no giant controls to add, etc)
-
Jun 25th, 2003, 02:43 PM
#2
Hyperactive Member
FindFirstFile, FindNextFile API's.....
Hmm... It really does sound like you're building a trojan from all these questions :|
-
Jun 25th, 2003, 04:22 PM
#3
Fanatic Member
-
Jun 25th, 2003, 11:31 PM
#4
Thread Starter
Fanatic Member
is there an example without a listview?
just something like debug.print file, type will do
-
Jun 26th, 2003, 12:45 AM
#5
Thread Starter
Fanatic Member
and that wont retrieve files 
anyone have a simple function to retrieve folders/files from a dir?
such as
ListFolders(Folder as String)
ListFiles(Folder as String)
-
Jun 26th, 2003, 03:50 AM
#6
check out "Dir" in VB help, the example should be more than enough for you.
-
Jun 26th, 2003, 06:45 AM
#7
Fanatic Member
http://mvps.org/vbnet/index.html?cod...umadvanced.htm
You might want to check around that site and not just visit the links I give you. There is a ton of useful stuff for VB there. You will find that using the API is the fastest way to enumerate files and folders. If you want to list all subfolders and their subfolders etc., you will need recursion.
Again, the site there WILL have what you want, but you might have to do a little work to find it.
I have two simple requests: 1) Use useful and specific topics. 2) Modify your topic to include [Resolved] when you problem has been resolved. Both of these make the bulletin boards more useful and efficient. Thanks.
-
Jun 26th, 2003, 06:56 AM
#8
-
Jun 26th, 2003, 08:39 AM
#9
Frenzied Member
Conflicting requirements...
Using DIR means no extras, just the VB run time. So this is efficient, but its not necessarily the quickest.
VB Code:
SearchName = "C:\Temp\*.*"
f = Dir(SearchName, vbReadOnly)
While f <> ""
MsgBox f
f = Dir()
Wend
This is the quickest way of adding the files to a listbox:
VB Code:
Private Declare Function SendMessageStr Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Private Sub Command1_Click()
Dim r As Long
r = SendMessageStr(List1.hwnd, &H18D, &H20, "C:\*.*")
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|