为什么我的控制台程序不能使用API setfiletime(50分)

  • 主题发起人 主题发起人 dfs
  • 开始时间 开始时间
D

dfs

Unregistered / Unconfirmed
GUEST, unregistred user!
程序如下:<br>program setfiletime;<br><br>{$APPTYPE CONSOLE}<br><br>uses<br>&nbsp; SysUtils,WINDOWS;<br>var<br>pa1,pa2,pa3 : string; &nbsp;//pa1:参数1 文件名;pa2:参数2 &nbsp; &nbsp;时间<br>i: Integer;<br>x,y,z:TFiletime;//变<br>function DateTimeToFileTime(DateTime:TDateTime):TFileTime;<br>var<br>&nbsp;SystemTime:TSystemTime;<br>begin<br>&nbsp;with SystemTime do<br>&nbsp;begin<br>&nbsp; &nbsp;DecodeDate(DateTime, wYear, wMonth, wDay);<br>&nbsp; &nbsp;DecodeTime(DateTime, wHour, wMinute, wSecond, wMilliSeconds);<br>&nbsp;end;<br>&nbsp;SystemTimeToFileTime(SystemTime,Result);<br>end;<br>begin<br><br><br>&nbsp; { TODO -oUser -cConsole Main : Insert code here }<br>&nbsp; &nbsp;pa1:=ParamStr(1);<br>&nbsp; &nbsp;pa2:=ParamStr(2);<br>&nbsp; &nbsp;writeln(pa1);<br>&nbsp; &nbsp;writeln(pa2);<br>&nbsp; &nbsp;//<br>&nbsp; &nbsp;i:= fileopen(pa1,fmOpenReadWrite);<br>&nbsp; &nbsp;x:=DateTimeToFileTime(strtodate(pa2));<br>&nbsp; &nbsp;y:=DateTimeToFileTime(strtodate(pa2));<br>&nbsp; &nbsp;z:=DateTimeToFileTime(strtodate(pa2));<br>&nbsp; &nbsp;SetFileTime(i,@x,@y,@z);<br>&nbsp; &nbsp;fileclose(i);<br><br>&nbsp; &nbsp;//<br><br>&nbsp; &nbsp;writeln('Press any key to continue...') ;<br>&nbsp; &nbsp;readln;<br>end.<br>
 
后退
顶部