你没看2楼的连接?
抄红雨老师的
Clea
#Define BYTE_2
256
#Define OF_READ
0
#Define OF_SHARE_DENY_NONE
64
#Define HFILE_ERROR
-1
#Define dwordPlus
4294967296
Declare Integer GetFileTime In kernel32 ;
Integer hFile, ;
string @lpCreationTime, ;
string @lpLastAccessTime, ;
string @lpLastWriteTime
Declare Integer FileTimeToLocalFileTime In kernel32 ;
string
lpFileTime, ;
string @lpLocalFileTime
Declare INTEGER FileTimeToSystemTime IN kernel32 ;
STRING
FILETIME,;
STRING @SYSTEMTIME
Declare INTEGER OpenFile IN kernel32 ;
STRING
lpFileName,;
STRING @lpReOpenBuff,;
INTEGER wStyle
Declare INTEGER CloseHandle IN kernel32 INTEGER hObject
Local lpCreationTime, lpLastAccessTime, lpLastWriteTime, lcFilename, hFile, FileTimeBuffer
lpCreationTime = space( 8 )
lpLastAccessTime = space( 8 )
lpLastWriteTime = space( 8 )
lcFilename = getfile("", "选择文件", "选定", 1)
lpReOpenBuff = REPLI (Chr(0), 250)
hFile = OpenFile (lcFilename, @lpReOpenBuff, OF_SHARE_DENY_NONE)
= GetFileTime( hFile, @lpCreationTime, @lpLastAccessTime, @lpLastWriteTime )
= CloseHandle (hFile)
? "文件: " + lcFilename
? "创建时间: ", transformFiletime(lpCreationTime)
? "访问时间: ", transformFiletime(lpLastAccessTime)
? "改写时间: ", transformFiletime(lpLastWriteTime)
Retu
*--------------------------------
Function transformFiletime
Lparameters LpFileTime
Local SystemTimeBuffer, FileTimeBuffer
FileTimeBuffer = space(8)
= FileTimeToLocalFileTime( LpFileTime, @FileTimeBuffer )
SystemTimeBuffer = SPACE(16)
fResult = FileTimeToSystemTime(FileTimeBuffer, @SystemTimeBuffer)
If fResult = 0
ldDateTime = {^1901/01/01 00:00:01}
Else
lnYear = ASC(SUBSTR(SystemTimeBuffer, 1, 1)) + (ASC(SUBSTR(SystemTimeBuffer, 2, 1))* BYTE_2)
lnMonth = ASC(SUBSTR(SystemTimeBuffer, 3, 1)) + (ASC(SUBSTR(SystemTimeBuffer, 4, 1))* BYTE_2)
lnDay = ASC(SUBSTR(SystemTimeBuffer, 7, 1)) + (ASC(SUBSTR(SystemTimeBuffer, 8, 1))* BYTE_2)
lnHour = ASC(SUBSTR(SystemTimeBuffer, 9, 1)) + (ASC(SUBSTR(SystemTimeBuffer, 10, 1))* BYTE_2)
lnMinute = ASC(SUBSTR(SystemTimeBuffer, 11, 1)) + (ASC(SUBSTR(SystemTimeBuffer, 12, 1))* BYTE_2)
lnSecond = ASC(SUBSTR(SystemTimeBuffer, 13, 1)) + (ASC(SUBSTR(SystemTimeBuffer, 14, 1))* BYTE_2)
lcBuild = "^" + ALLTRIM(STR(lnYear)) ;
+ "/" + ALLTRIM(STR(lnMonth)) ;
+ "/" + ALLTRIM(STR(lnDay)) ;
+ " " + ALLTRIM(STR(lnHour)) ;
+ ":" + ALLTRIM(STR(lnMinute)) ;
+ ":" + ALLTRIM(STR(lnSecond))
ldDateTime = {&lcBuild}
Endif
Return ldDateTime
Endfunc