InoFiles




Option Explicit
Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
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
Public Const GENERIC_READ = &H80000000
Public Const FILE_SHARE_READ = &H1
Public Const OPEN_EXISTING = 3
Public Const INVALID_HANDLE_VALUE = -1
Declare Function GetFileTime Lib "Kernel32" (ByVal hFile As Long,
lpCreationTime As FILETIME, lpLastAccessTime As FILETIME, lpLastWriteTime As FILETIME) As Long
Declare Function CreateFile Lib "Kernel32" Alias "CreateFileA" _
(ByVal lpFileName As String, _
ByVal dwDesiredAccess As Long, _
ByVal dwShareMode As Long, _
ByVal lpSecurityAttributes As Long, _
ByVal dwCreationDisposition As Long, _
ByVal dwFlagsAndAttributes As Long, _
ByVal hTemplateFile As Long) As Long
Declare Function CloseHandle Lib "Kernel32" (ByVal hObject As Long) As Long
Declare Function FileTimeToSystemTime Lib "Kernel32" (lpFileTime As
FILETIME, lpSystemTime As SYSTEMTIME) As Long
Sub GetFileInfo(ByVal FileName As String, stCreation As String, stModify As
String, stAccess As String)
Dim fp As Long
Dim dtCreation As FILETIME
Dim dtModify As FILETIME
Dim dtAccess As FILETIME
Dim st As SYSTEMTIME
fp = CreateFile(FileName, GENERIC_READ, FILE_SHARE_READ, 0,
OPEN_EXISTING, 0, 0)
If fp <> INVALID_HANDLE_VALUE Then
GetFileTime fp, dtCreation, dtAccess, dtModify
FileTimeToSystemTime dtCreation, st
stCreation = Format(st.wDay & "/" & st.wMonth & "/" & st.wYear,
"Long Date") & " - " & _
Format(st.wHour & ":" & st.wMinute & ":" & st.wSecond,
"hh.mm.ss")
FileTimeToSystemTime dtModify, st
stModify = Format(st.wDay & "/" & st.wMonth & "/" & st.wYear, "Long
Date") & " - " & _
Format(st.wHour & ":" & st.wMinute & ":" & st.wSecond,
"hh.mm.ss")
FileTimeToSystemTime dtAccess, st
stAccess = Format(st.wDay & "/" & st.wMonth & "/" & st.wYear, "Long
Date") & " - " & _
Format(st.wHour & ":" & st.wMinute & ":" & st.wSecond,
"hh.mm.ss")
End If
CloseHandle fp
End Sub

Public Sub Main()
Dim FileName As String
Dim vCreation As String
Dim vModify As String
Dim vAccess As String
FileName = InputBox("Nome File? ")
GetFileInfo FileName, vCreation, vModify, vAccess
MsgBox "Data Creazione: " & vCreation & vbCrLf & _
"Ultima modifica: " & vModify & vbCrLf & _
"Ultimo accesso: " & vAccess
End Sub

Inserire questo codice in un modulo BAS per ottenere le
informazioni su un file (includere il path).
Le informazioni sono: Creazione, Ultima modifica e ultimo
accesso.










( inofiles.html )- by Paolo Puglisi - Modifica del 17/12/2023