API函数
SetSystemTime详细参数设置见SDK帮助
SetSystemTime详细参数设置见SDK帮助
解决方案 »
- 计算字段出错,请问如何解决?
- TControl中color属性的问题
- 一个截取字符串的问题!
- (转载)进程三级跳,实现在win9x,nt,w2k下进程的深度隐藏,按CTRL+ALT+DEL看不到,用终极防线也看不到
- 50 急!求算法:已知坐标(X,Y)和半径R,画一半圆,最好有DELPHI代码,另API函数ARC怎么用,能解释一下,谢!
- sql问题
- 急!急!急!敢问各位高手,在stringgrid中如何敲enter健使焦点移到下一格中,实现tab健的效果?
- 如何捕捉dbgrid 中录入数字的错误
- Delphi中用ADO连Access为什么巨慢无比
- 一个很奇怪的问题????
- 如何在MDI主窗体中访问由DLL创建的MDI子窗体?
- 各位大虾老鸟,谁搞过开发类似word中自动生成表格的软件?
SysTime: TSystemTime;
DateTime: TDateTime;begin
DateTime := Now;
ReplaceDate(DateTime, Calendar.CalendarDate);
DateTimeToSystemTime(DateTime, SysTime);
SetLocalTime(SysTime);
end;
1、定义变量
var SystemTime: TSystemTime;
2、转换日期
DateTimeToSystemTime(StrToDatetime('1999-09-01 11:12:12' ),SystemTime);
3、改变系统日期
SetSystemTime(SystemTime);
到此系统日期已经改变,可是由于API函数SetSystemTime()本身存在的BUG,在你改变系统日期以后,等待一会,你会看到系统的日期是对的,可是时间却错了,并不是我们设定的11:12:12,这样的问题看来需要微软才能解决了
///////////////////////////////////////////
{ SetDate sets the current date in the operating system. Valid }
{ parameter ranges are: Year 1980-2099, Month 1-12 and Day }
{ 1-31. If the date is not valid, the function call is ignored. }
procedure SetDate(Year, Month, Day: Word); assembler;
asm
MOV CX,Year
MOV DH,BYTE PTR Month
MOV DL,BYTE PTR Day
MOV AH,2BH
INT 21H
end; { SetTime sets the time in the operating system. Valid }
{ parameter ranges are: Hour 0-23, Minute 0-59, Second 0-59 and }
{ Sec100 (hundredths of seconds) 0-99. If the time is not }
{ valid, the function call is ignored. }
procedure SetTime(Hour, Minute, Second, Sec100: Word); assembler;
asm
MOV CH,BYTE PTR Hour
MOV CL,BYTE PTR Minute
MOV DH,BYTE PTR Second
MOV DL,BYTE PTR Sec100
MOV AH,2DH
INT 21H
end; function SetSystemDateTime(Year, Month, Day, Hour, Minute, Second: word): integer; export;
begin
SetDate(Year, Month, Day);
SetTime(Hour, Minute + 1, Second, 0);
result := 1;
end;
不过有另外一个小小的问题是:系统时间已经按要求更改啦,单屏幕右下角的显示且不能自动ReFresh,有没有办法啊?
var
ModifyTime:pSystemTime;
OriginateTiem:TDateTime;
begin
DateTimeToSystemTime(OriginatTime,ModifyTime);
SetLocalTime(Time(ModifyTime^));
.
.
.
end;