Is there a function that can be called to perform a directory listing that I can look up? I've been looking through the win32 SDK Help file for awhile and can't come across anything nor in a search engine. I want to get a listing of a directory w/o the use of common dialogs. How would I go about doing this?

Thank you
-SiLenCe
Posted on 2002-06-25 00:36:46 by SiLenCe
Look for FindFirstFile / FindNextFile.
Also the search engine is helpfull, because exactly the same question was asked before:


http://www.asmcommunity.net/board/index.php?topic=2454&highlight=findfirstfile+findnextfile
http://www.asmcommunity.net/board/index.php?topic=2916&highlight=findfirstfile+findnextfile
Posted on 2002-06-25 00:51:00 by bazik
ForFind proc HWnd :DWORD, Path :DWORD, match :DWORD

LOCAL PathName ; TAMMAX = 260
LOCAL fnd :WIN32_FIND_DATA
LOCAL hFind :DWORD

invoke lstrcpy, ADDR PathName, Path ; put initial dir to PathName
invoke lstrcat, ADDR PathName, match ; add \*.* to PathName

invoke FindFirstFile, addr PathName, addr fnd
mov hFind, eax

.while eax > 0

lea esi,fnd.cFileName ; skip "." y ".."
cmp ,byte ptr "."
je nextf

.if fnd.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY

; ********* IS A DIR *************

invoke SetCurrentDirectory, ADDR fnd.cFileName ; into dir

invoke GetCurrentDirectory, TAMMAX, ADDR buffer1

invoke ForFind, HWnd, ADDR buffer1, match ; recursive call

invoke SetCurrentDirectory, ADDR dirback ; go back

.else ; ********* IS A FILE ************

inc counter ; count number of files

lea esi, fnd.cFileName
mov lvi.pszText,esi ; put in a ListView

invoke SendMessage, hListView, LVM_INSERTITEM, 0, addr lvi

.endif

nextf: invoke FindNextFile, hFind, addr fnd ; next

.endw

invoke FindClose,hFind
ret

ForFind endp
Posted on 2002-06-25 14:53:34 by mnemox