This was handed to me recently. It isn't my code and I can't find the author... but it seems to work fairly well.<br>
<br>
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, ByVal NoSecurity As Long, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long<br>
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long<br>
Private Declare Function GetFileTime Lib "kernel32" (ByVal hFile As Long, lpCreationTime As FILETIME, lpLastAccessTime As FILETIME, lpLastWriteTime As FILETIME) As Long<br>
Private Type FILETIME<br>
dwLowDateTime As Long<br>
dwHighDateTime As Long<br>
End Type<br>
<br>
Private Const GENERIC_READ = &H80000000<br>
Private Const FILE_SHARE_READ = &H1<br>
Private Const FILE_SHARE_WRITE = &H2<br>
Private Const OPEN_EXISTING = 3<br>
<br>
Private Function FileTimeToDate(ft As FILETIME) As Date<br>
<br>
Const TICKS_PER_SECOND = 10000000<br>
<br>
Dim lo_time As Double<br>
Dim hi_time As Double<br>
Dim seconds As Double<br>
Dim hours As Double<br>
Dim the_date As Date<br>
<br>
If ft.dwLowDateTime < 0 Then<br>
lo_time = 2 ^ 31 + (ft.dwLowDateTime And &H7FFFFFFF)<br>
Else<br>
lo_time = ft.dwLowDateTime<br>
End If<br>
<br>
If ft.dwHighDateTime < 0 Then<br>
hi_time = 2 ^ 31 + (ft.dwHighDateTime And &H7FFFFFFF)<br>
Else<br>
hi_time = ft.dwHighDateTime<br>
End If<br>
<br>
seconds = (lo_time + 2 ^ 32 * hi_time) / TICKS_PER_SECOND<br>
hours = CLng(seconds / 3600)<br>
seconds = seconds - hours * 3600<br>
<br>
the_date = DateAdd("h", hours, "1/1/1601 6:00 AM"

<br>
the_date = DateAdd("s", seconds, the_date)<br>
FileTimeToDate = the_date<br>
End Function<br>
<br>
Private Function GetFileTimes(ByVal file_name As String, ByRef date_created As Date, ByRef date_accessed As Date, ByRef date_written As Date) As Boolean<br>
Dim file_handle As Long<br>
Dim creation_time As FILETIME<br>
Dim access_time As FILETIME<br>
Dim write_time As FILETIME<br>
<br>
file_handle = CreateFile(file_name, GENERIC_READ, _<br>
FILE_SHARE_READ Or FILE_SHARE_WRITE, _<br>
0&, OPEN_EXISTING, 0&, 0&)<br>
If file_handle = 0 Then<br>
GetFileTimes = True<br>
Exit Function<br>
End If<br>
<br>
If GetFileTime(file_handle, creation_time, _<br>
access_time, write_time) = 0 _<br>
Then<br>
GetFileTimes = True<br>
Exit Function<br>
End If<br>
<br>
If CloseHandle(file_handle) = 0 Then<br>
GetFileTimes = True<br>
Exit Function<br>
End If<br>
<br>
date_created = FileTimeToDate(creation_time)<br>
date_accessed = FileTimeToDate(access_time)<br>
date_written = FileTimeToDate(write_time)<br>
End Function<br>
<br>
Private Sub Command1_Click()<br>
Dim date_created As Date<br>
Dim date_accessed As Date<br>
Dim date_written As Date<br>
Dim txt As String<br>
<br>
If GetFileTimes(Text1.Text, date_created, date_accessed, date_written) Then<br>
lblTimes.Caption = ""<br>
MsgBox "Error getting file times"<br>
Else<br>
txt = "Created:" & vbCrLf & " " & Format$(date_created) & vbCrLf & _<br>
"Last Accessed:" & vbCrLf & " " & Format$(date_accessed) & vbCrLf & _<br>
"Last Written:" & vbCrLf & " " & Format$(date_written)<br>
lblTimes.Caption = txt<br>
End If<br>
End Sub<br>
<br>
Private Sub Form_Load()<br>
Dim file_name As String<br>
<br>
file_name = App.Path<br>
If Right$(file_name, 1) <> "\" Then file_name = file_name & "\"<br>
file_name = file_name & "Form1.frm"<br>
Text1 = file_name<br>
End Sub<br>
<br>
<br>
<p> <br><a href=mailto: > </a><br><a href=
Vorpalcom home page</a><br>Send me suggestions or comments on my current software project.