Login
`
Templates, Tools and Utilities
|
||
Icetips Article
Back to article list
Search Articles
Add Comment
Printer friendly
Direct link
Par2: Locating (finding) a file 2004-08-05 -- Danie de Beer module('kernel32.lib')
findfirstfile(*cstring,*?),raw,pascal,long,name('FindFirstFileA')
findnextfile(long,*?),raw,pascal,long,name('FindNextFileA')
end
MAX_PATH equate(32)
filehandling long
filesearch cstring(30)
fileerror long
WIN32_FIND_DATA group,PRE()
dwFileAttributes Long
ftCreationTime GROUP
dwLowDateTime1 Long
dwHighDateTime1 Long
END
ftLastAccessTime GROUP
dwLowDateTime2 Long
dwHighDateTime2 Long
END
ftLastWriteTime GROUP
dwLowDateTime3 Long
dwHighDateTime3 Long
END
nFileSizeHigh Long
nFileSizeLow Long
dwReserved0 Long
dwReserved1 Long
cFileName cString(MAX_PATH)
cAlternate cString(14)
End
FILE_ATTRIBUTE_DIRECTORY EQUATE(0010h)
FILE_ATTRIBUTE_ARCHIVE equate(0020h)
FILE_ATTRIBUTE_COMPRESSED equate(0800h)
FILE_ATTRIBUTE_HIDDEN equate(0002h)
FILE_ATTRIBUTE_NORMAL equate(0080h)
FILE_ATTRIBUTE_READONLY equate(0001h)
FILE_ATTRIBUTE_SYSTEM equate(0004h)
FILE_ATTRIBUTE_TEMPORARY equate(0100h)
FindfirstA returns an handle and return -1 (invalid handle) if something is
wrong. The handle must be used as input in findnextfileA.
Example:
filesearch='c:\*.*' !or Filename
filehandle=findfirstfile(filesearch,WIN32_FIND_DATA)
!
! Do something with information in win32_find_data
!
if filehandle <> -1
loop
fileerror=findnextfile(filehandling,win32_find_data)
if fileerror<>0
!
! Do something with information in win32_find_data
!
else
break
end
end
end
Today is November 21, 2024, 3:35 am This article has been viewed 35217 times.
|
|