Hello, Can someone give me an example or tell me how I could go about scanning the hard drive for a specific file type and adding the path to a tree control? Thanks in advance MacDeath
Posted on 2001-06-17 18:15:00 by MacDeath
well you find the files and directories with findfirst and findnext. You'll have to put the directories in an array and go don until you find no more directories, then just go one up and process the next directory in the list until ...
Posted on 2001-06-17 20:04:00 by Hiroshimator
This works. For example if your root dir is "d:\" use that for initial path and it'll find every dir and file on drive.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;
FindFile proc Path :DWORD

LOCAL	wfd:WIN32_FIND_DATA
LOCAL	Buffer
LOCAL	hFile:DWORD


invoke wsprintf,addr Buffer,offset szS,Path,ADDR szFile
invoke FindFirstFile,ADDR Buffer,ADDR wfd
cmp eax,INVALID_HANDLE_VALUE
jz @f
mov hFile, eax
jmp @dir

@next:
invoke FindNextFile,hFile,addr wfd
or eax,00h
jnz @dir
invoke FindClose,hFile
xor eax,eax
ret

@dir:
mov al,byte ptr
cmp al,2eh
jz @next
invoke wsprintf,addr Buffer,offset szS2,\
Path,addr wfd.cFileName

invoke lstrcpy,addr szPathBuf,addr Buffer

***"invoke My_Proc,addr szPathBuf" ;here you got full path and file name***

invoke FindFile,ADDR Buffer
jmp @next
@@:

ret

FindFile endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
best regards, czDrillard edit: added code tags This message was edited by Hiroshimator, on 6/18/2001 5:49:48 AM
Posted on 2001-06-18 04:16:00 by czDrillard