Страница: 1 |
|
Вопрос: FileTime для Alban
|
Добавлено: 09.10.04 23:03
|
|
Автор вопроса: cresta
|
Private Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long
Private Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (ByVal hFindFile As Long, lpFindFileData As WIN32_FIND_DATA) As Long
Private Declare Function GetFileAttributes Lib "kernel32" Alias "GetFileAttributesA" (ByVal lpFileName As String) As Long
Private Declare Function FindClose Lib "kernel32" (ByVal hFindFile As Long) As Long
Private Declare Function FileTimeToSystemTime Lib "kernel32" (lpFileTime As FILETIME, lpSystemTime As SYSTEMTIME) As Long
Private Declare Function FileTimeToLocalFileTime Lib "kernel32" (lpFileTime As FILETIME, lpLocalFileTime As FILETIME) As Long
Const INVALID_HANDLE_VALUE = -1
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 * 260
cAlternate As String * 14
End Type
Private Sub Command1_Click()
Dim hSearch As Long
Dim WFD As WIN32_FIND_DATA
Dim Ft1 As FILETIME, Ft2 As FILETIME, SysTime As SYSTEMTIME
hSearch = FindFirstFile("C:\Windows", WFD)
If hSearch <> INVALID_HANDLE_VALUE Then
Ft2 = WFD.ftCreationTime
FileTimeToLocalFileTime Ft2, Ft1
FileTimeToSystemTime Ft1, SysTime
MsgBox "Папка C:\Windows была создана " & LTrim(Str$(SysTime.wDay)) & "." & Str$(SysTime.wMonth) & "." & LTrim(Str$(SysTime.wYear))
End If
FindClose hSearch
End Sub
Ответить
|
Страница: 1 |
Поиск по форуму