test my training code (two or three monthes ago I found Dave's code and modified it a little)
Code:
#Compile Exe #Register None #Include "WIN32API.INC" DefInt A-Z Function FileDateTime(ft As FileTime) As String Local st As SystemTime Local zText As Asciiz * 255 Local Temp As String ' -- Convert the file time from UTC to local time FileTimeToLocalFileTime ft, ft ' -- Convert the file time into a compatible system time FileTimeToSystemTime ft, st ' -- Create a date string using the local settings GetDateFormat %LOCALE_USER_DEFAULT, %DATE_SHORTDATE, st, ByVal %NULL, zText, 255 Temp = zText ' -- Create a time string using the local settings GetTimeFormat %LOCALE_USER_DEFAULT, %TIME_NOSECONDS, st, ByVal %NULL, zText, 255 ' -- Return the file date and time Function = Temp + " " + zText End Function Function PbMain Dim hFindFile As Long Dim lpFindFileData As WIN32_FIND_DATA hFindFile = FindFirstFile("C:\*.*", lpFindFileData) If hFindFile <> %INVALID_HANDLE_VALUE Then Do If (lpFindFileData.dwFileAttributes And &H18) <> 0 Then ' Directory / Label Else MsgBox lpFindFileData.cFileName + _ " Created " + FileDateTime$(lpFindFileData.ftCreationTime) + _ " LastAccess " + FileDateTime$(lpFindFileData.ftLastAccessTime) + _ " WriteTime = " + FileDateTime$(lpFindFileData.ftLastWriteTime) + _ " Attr = " + Str$(lpFindFileData.dwFileAttributes) + _ " Size = " + Str$(CDbl(lpFindFileData.nFileSizeHigh) * CDbl(&H10000) * CDbl(&H10000) + _ CDbl(lpFindFileData.nFileSizeLow)) End If If FindNextFile(hFindFile, lpFindFileData) = 0 Then Exit Do Loop FindClose hFindFile End If End Function
------------------
Leave a comment: