参考:
DECLARE LONG CreateFile IN Kernel32 STRING@, LONG, LONG, STRING@, LONG, LONG, STRING@
DECLARE LONG CloseHandle IN Kernel32 LONG
DECLARE LONG SystemTimeToFileTime
IN Kernel32 STRING@, STRING@
DECLARE LONG LocalFileTimeToFileTime IN Kernel32 STRING@, STRING@
DECLARE LONG SetFileTime IN Kernel32 LONG, STRING@, STRING@, STRING@
cPath = "_test.txt"
hFile = CreateFile(cPath,0x40000000,0,NULL,0x03,0x80,NULL)
IF hFile == -1
? "打开文件失败"
RETURN
ENDIF
* SYSTEMTIME 结构,修改为2018/1/5其他为0
st = BINTOC(2018,"2RS");
+ BINTOC(1,"2RS") + 0h0000;
+ BINTOC(5,"2RS") + REPLICATE(0h00,8)
ft = REPLICATE(0h00,8) && FILETIME 结构
SystemTimeToFileTime(@st, @ft)
LocalFileTimeToFileTime(@ft, @ft) && 本地时间时间、UTC转换
SetFileTime(hFile, @ft, @ft, @ft) && 创建时间、最近访问时间和最近修改时间都为ft
CloseHandle(hFile)
[此贴子已经被作者于2018-1-4 23:15编辑过]