* 得到文件创建、访问日期
PARAMETERS lcFilename
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,hFile,FileTimeBuffer
lpCreationTime = space( 8 )
lpLastAccessTime = space( 8 )
lpLastWriteTime = space( 8 )

*lcFilename = getfile("dbf", "数据表文件", "选定", 1)
lpReOpenBuff = REPLI(Chr(0),250)
hFile = OpenFile (lcFilename,@lpReOpenBuff,OF_SHARE_DENY_NONE)
= GetFileTime( hFile, @lpCreationTime, @lpLastAccessTime, @lpLastWriteTime )
= CloseHandle (hFile)
*wait "文件: " + lcFilename+chr(13)+"创建时间: "+dtoc(transformFiletime(lpCreationTime))+chr(13)+"访问时间: "+dtoc(transformFiletime(lpLastAccessTime)) window
if transformFiletime(lpLastAccessTime)<transformFiletime(lpCreationTime)
   =messagebox("    请将系统日期设置正确后再运行本系统！",48+0,"系统提示：")
   clear events
   quit
endif
Retu abs(transformFiletime(lpLastAccessTime)-transformFiletime(lpCreationTime))

*--------------------------------
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}
	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)
		lcBuild = "^" + ALLTRIM(STR(lnYear))+"/"+ALLTRIM(STR(lnMonth))+"/"+ALLTRIM(STR(lnDay)) 
		ldDateTime = {&lcBuild}
	Endif
	Return ldDateTime
Endfunc