Is there an 'exist' function for directories? exist c:\dirpath without trailing backslash works but beeps :lol
invoke SHGetFileInfo, addr MyDir,
NULL,
addr sfi,
sizeof sfi,
SHGFI_DISPLAYNAME
Seems to work for directories, not sure if it is the best way... returns 0 if the directory does not exist and 1 if it does
I know this is crude but I store the current path and change directory to a path to test. If it returns an error it does not exist. If it does not return an error I change back to the current path with a verified directory.
Use GetFileAttributes and test the return value for INVALID_FILE_ATTRIBUTES (error) then FILE_ATTRIBUTE_DIRECTORY.
FindFirstFile ?
GetFileAttributes takes 1 parameter (the name) and returns a dword, no need to allocate structures then close handles.
:lol the only one I'd thought of was FindFirstFile.... let me rephrase which one's best
EDIT: Thanks Sinsi (and all :wink)will try that one then :bg
There are many ways to kill a bird :bg Didn't think about FindFirstFile.
You can kill a bird with FindFirstFile? :lol
SHGetFileInfo is brutally slow and too much for this simple task. I'd go with Sinsi's suggestion. Searching also found this thread :
http://www.masm32.com/board/index.php?topic=5259.0