type FileTime from structure
ulong LowDateTime
ulong HighDateTime
end type
///////////////////////////////////////////
type OPENFILENAME from structure
long lstructsize
long hwndowner
long hinstance
long lpstrfilter
long lpstrcustomfilter
long nMaxCustomFilter
long nFilterIndex
long lpstrFile
long nMaxFile
long lpstrFileTitle
long nMaxFileTitle
long lpstrInitialDir
long lpstrTitle
long Flags
integer nFileOffset
integer nFileExtension
long lpstrDefExt
long lCustData
long lpfnHook
long lpTemplateName
end type
/////////////////////////////////////////////
type BY_HANDLE_FILE_INFORMATION from structure
unsignedlong dwFileAttributes
unsignedlong dwLowDateTime_creation
unsignedlong dwHighDateTime_creation
unsignedlong dwLowDateTime_lastaccess
unsignedlong dwHighDateTime_lastaccess
unsignedlong dwLowDateTime_lastwrite
unsignedlong dwHighDateTime_lastwrite
unsignedlong dwVolumeSerialNumber
unsignedlong nFileSizeHigh
unsignedlong nFileSizeLow
unsignedlong nNumberOfLinks
unsignedlong nFileIndexHigh
unsignedlong nFileIndexLow
end type
////////////////////////////////////////////////////////////
CONSTANT LONG GENERIC_READ = 2147483648
CONSTANT LONG GENERIC_WRITE = 1073741824
CONSTANT LONG CREATE_NEW = 1
CONSTANT LONG CREATE_ALWAYS = 2
CONSTANT LONG OPEN_EXISTING = 3
CONSTANT LONG OPEN_ALWAYS=4
CONSTANT LONG FILE_SHARE_READ=1
CONSTANT LONG FILE_SHARE_WRITE=2
CONSTANT LONG FILE_FLAG_RANDOM_ACCESS = 268435456
CONSTANT LONG MAXDWORD=65535
/////////////////////////////////////////////////////////////
public function integer of_comparefiletime (string file1, string file2);//// 比较文件时间,-1 file1早;0 file1=file2;1 file1晚 else出错
long FileHandle1,FileHandle2;
long rtn;
FILETIME lpCreationTime,lpLastAccessTime,FileTime1,FileTime2
Boolean brtn1,brtn2;
//////////
FileHandle1 = createfile( File1, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, 0 )
FileHandle2 = createfile( File2, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, 0 )
if FileHandle1 > 0 and FileHandle2 > 0 then
// 检查文件日期
brtn1 = GetFileTime( FileHandle1, lpCreationTime, lpLastAccessTime, FileTime1 )
brtn2 = GetFileTime( FileHandle2, lpCreationTime, lpLastAccessTime, FileTime2 )
if brtn1 and brtn2 then
rtn = CompareFileTime(FileTime1,FileTime2)
else
rtn = -200;
end if
else
rtn = -100;
end if
if FileHandle1>0 then of_closeFile(FileHandle1);
if FileHandle2>0 then of_closeFile(FileHandle2);
return rtn;
end function
///////////////////////////////////////////////////////
public function boolean of_closefile (long fhandle);
Boolean ret
ret = closehandle( fhandle )
if ret = false then
of_showwindowerror()
end if
return ret