#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <Date.au3>
#include <WindowsConstants.au3>
#include <Date.au3>
Global $iMemo
_Main()
Func _Main()
Local $hFile, $tFile, $aTime
GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 12, 500, 0, "Courier New")
GUISetState()
$hFile = _WinAPI_CreateFile(@ScriptDir & "\新建文本文档.txt", 2)
If $hFile = 0 Then _WinAPI_ShowError("Unable to open file")
$aTime = _Date_Time_GetFileTime($hFile)
_WinAPI_CloseHandle($hFile)
MemoWrite("创建时间: " & _Date_Time_FileTimeToStr($aTime[0],1))
MemoWrite("访问时间: " & _Date_Time_FileTimeToStr($aTime[1],1))
MemoWrite("修改时间: " & _Date_Time_FileTimeToStr($aTime[2],1))
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
FileDelete(@ScriptDir & "\Test.xyz")
EndFunc
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc
上面这段代码读取到的文件时间和我系统上该文件的时间不一致是怎么回事?求解决!
图中1为系统显示的文件时间,2为上面代码读取到的时间,3为我的系统时间和时区
|