I've written a File Scanner in Access 97 that records File name, path, size etc and put all the information in a database.
I've been trying to find the Date Last Modified but im not having anyluck.
Does anyone have a decent example of how it is written as I am aware that there are a few API's required before you get an actual date / time value.
So far I have the following API's but I can't work out what needs to be done..
I've been trying to find the Date Last Modified but im not having anyluck.
Does anyone have a decent example of how it is written as I am aware that there are a few API's required before you get an actual date / time value.
So far I have the following API's but I can't work out what needs to be done..
Code:
Dim strHostname As String
Dim sfi As SHFILEINFO ' Passes the values of SHFILEINFO to the string
Dim FindFileInfo As WIN32_FIND_DATA
Private Declare Function FindFirstFile Lib "kernel32.dll" Alias "FindFirstFileA" (ByVal lpFileName As String, ByRef lpFindFileData As WIN32_FIND_DATA) As Long
Private Declare Function FindNextFile Lib "kernel32.dll" Alias "FindNextFileA" (ByVal hFindFile As Long, ByRef lpFindFileData As WIN32_FIND_DATA) As Long
Private Declare Function FindClose Lib "kernel32.dll" (ByVal hFindFile As Long) As Long
Private Declare Function GetFullPathName Lib "kernel32.dll" Alias "GetFullPathNameA" (ByVal lpFileName As String, ByVal nBufferLength As Long, ByVal lpBuffer As String, ByVal lpFilePart As String) As Long
Private Declare Function SHGetFileInfo Lib "shell32.dll" Alias "SHGetFileInfoA" (ByVal pszPath As String, ByVal dwFileAttributes As Long, ByRef psfi As SHFILEINFO, ByVal cbFileInfo As Long, ByVal uFlags As Long) As Long
Private Declare Function FileTimeToSystemTime Lib "kernel32.dll" (ByRef lpFileTime As FILETIME, ByRef lpSystemTime As SYSTEMTIME) As Long
Private Declare Function GetFileTime Lib "kernel32.dll" (ByVal hFile As Long, ByRef lpCreationTime As FILETIME, ByRef lpLastAccessTime As FILETIME, ByRef lpLastWriteTime As FILETIME) As Long
Private Declare Function FileTimeToLocalFileTime Lib "kernel32.dll" (ByRef lpFileTime As FILETIME, ByRef lpLocalFileTime As FILETIME) As Long
'SHGetFileInfo constants.
Private Const MAX_PATH As Integer = 260 'Defines the maximum path lengh.
Private Const MAXDWORD = &HFFFFFFFF
Private Const INVALID_HANDLE As Long = -1
Private Const SHGFI_DISPLAYNAME = &H100 ' get display name
Private Const SHGFI_TYPENAME = &H400 ' get type name
Private Const SHGFI_EXETYPE = &H2000 ' return exe type
Private Const SHGFI_PIDL = &H8 ' pszPath is a pidl
Private Const SHGFI_USEFILEATTRIBUTES = &H800
Private Const FILE_ATTRIBUTE_DIRECTORY = &H10
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Private Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternativeFileName As String * 14
End Type
Private Type SHFILEINFO
hIcon As Long ' out: icon
iIcon As Long ' out: icon index
dwAttributes As Long ' out: SFGAO_ flags
szDisplayName As String * MAX_PATH ' out: display name (or path)
szTypeName As String * 80 ' out: type name
End Type