system time(100分)

  • 主题发起人 主题发起人 lliu
  • 开始时间 开始时间
L

lliu

Unregistered / Unconfirmed
GUEST, unregistred user!
我欲用DELPHI编写一小程序修改计算机系统时间,那位朋友知道,请帮帮忙!<br>谢谢!
 
procedure settime(hour, min, sec, hundreths : byte); assembler;<br>asm<br>&nbsp; mov &nbsp;ch, hour<br>&nbsp; mov &nbsp;cl, min<br>&nbsp; mov &nbsp;dh, sec<br>&nbsp; mov &nbsp;dl, hundreths<br>&nbsp; mov &nbsp;ah, $2d<br>&nbsp; int &nbsp;$21<br>end;<br>procedure setdate(year : word; month, day : byte); assembler;<br>asm<br>&nbsp; mov &nbsp;cx, year<br>&nbsp; mov &nbsp;dh, month<br>&nbsp; mov &nbsp;dl, day<br>&nbsp; mov &nbsp;ah, $2b<br>&nbsp; int &nbsp;$21<br>end;<br><br>给分吧 :-p
 
危险。<br>用Windows API<br><br>var<br>&nbsp; st: TSystemTime;<br>begin<br>&nbsp; GetSystemTime (st);<br>&nbsp; with st do<br>&nbsp; begin<br>&nbsp; &nbsp; wYear := 2000;<br>&nbsp; &nbsp; wMonth := 5;<br>&nbsp; &nbsp; wDay := 1;<br>&nbsp; &nbsp; wHour := 20;<br>&nbsp; &nbsp; wMinute := 0;<br>&nbsp; &nbsp; wSecond := 0;<br>&nbsp; &nbsp; wMilliseconds := 0;<br>&nbsp; end;<br>&nbsp; SetSystemTime (st);<br>end;<br>
 
同意partisan,<br>&gt;&gt;beta<br>能说说你使用汇编的原意吗?<br>不会是进行破坏把?<br>
 
to hsw:别开玩笑了,用汇编快呀,只要你不乱用.<br>要不然Delphi何必内嵌汇编语言?你说呢?
 
多人接受答案了。
 
如下面的程序,为什么出现设置的时间与输入时间不一致!急!<br>getsystemtime(st);<br>&nbsp; time1:=edit1.text;//(输入时间如:8:10:20);<br>&nbsp; date1:=edit2.text;//(输入日期:00-5-7)<br>&nbsp; datetime:=strtodatetime(date1+' '+time1);<br>&nbsp;// datetime:=strtodatetime(edit12.text);<br>&nbsp; DecodeDate(datetime, Year, Month, Day);<br>&nbsp; DecodeTime(datetime, Hour, Min, Sec, MSec);<br>&nbsp; with st do<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; wyear:=year;<br>&nbsp; &nbsp; wmonth:=month;<br>&nbsp; &nbsp; wday:=day;<br>&nbsp; &nbsp; whour:=hour;<br>&nbsp; &nbsp; wminute:=min;<br>&nbsp; &nbsp; wsecond:=sec;<br>&nbsp; &nbsp; wmilliseconds:=msec;<br>&nbsp; &nbsp; end;<br>&nbsp;// DateTimeToSystemTime(DateTime,st);<br>&nbsp; setsystemtime(st);
 
后退
顶部