' windows api testing, build a set of
' useful routines
' starting code is lifted from the qb64.org wiki to
' bootstrap the effort, then i'll add my own stuff.
'
' txb 27 December 2018
' use a cmd console window instead of a screen
' Windows API constants
' FINDEX_INFO_LEVELS
CONST FindExInfoStandard
= 0&
CONST FindExInfoBasic
= 1&
' FINDEX_SEARCH_OPS
CONST FindExSearchNameMatch
= 0&
CONST FindExSearchLimitToDirectories
= 1&
CONST FindExSearchLimitToDevices
= 2&
' FILETIME
' WIN32_FIND_DATA
LastAccessTime
AS FileTime
LastWriteTime
AS FileTime
'=== SHOW WINDOWS DIRECTORY
Result
= WINDirectory
(WinDir$
, LEN(WinDir$
))
'=== SHOW SYSTEM DIRECTORY
Result
= SYSDirectory
(SysDir$
, LEN(SysDir$
))
'=== SHOW CURRENT DIRECTORY
Result
= CURDirectory
(LEN(CurDir$
), CurDir$
)
'=== SHOW TEMP DIRECTORY
Result
= TempPath
(LEN(TempDir$
), TempDir$
)
'=== SHOW CURRENT PROGRAM
Result
= GetModuleFileNameA
(0, FileName$
, LEN(FileName$
))
' now try to find all the .bas files in this directory
DIM ffdata
AS FindFileData
searchString = "*.bas"
hfind = FindFirstFileEx(searchString, FindExInfoStandard&, ffdata, 0, FindExSearchNameMatch, 0)
PRINT "find first failed" PRINT "found ", ffdata.FileName
Result = FindClose(hfind)
' and done