delphi中调用api函数(参数匹配问题,急!)
BOOL SetSystemTime( CONST SYSTEMTIME *lpSystemTime // address ofsystem time to set
);
这个api函数中参数类型lpsystemtime在delphi中怎样匹配()有没有相关的转换函数
其他api函数参数也可能存在这个问题吧,希望可以一并解决
谢谢先
定义一个_SYSTEMTIME类型的变量
typedef struct _SYSTEMTIME { // st
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME;
Members
wYear
Specifies the current year.
wMonth
Specifies the current month; January = 1, February = 2, and so on.
wDayOfWeek
Specifies the current day of the week; Sunday = 0, Monday = 1, and so on.
wDay
Specifies the current day of the month.
wHour
Specifies the current hour.
wMinute
Specifies the current minute.
wSecond
Specifies the current second.
wMilliseconds
Specifies the current millisecond
procedure Modify_CurrentDate(Year,Month,Day:word);
var
TempSystemTime:systemTime;
begin
TempSystemTime.wYear:=Year;
TempSystemTime.wMonth:=Month;
TempSystemTime.wDay:=Day;
with TempSystemTime do
DecodeTime(Time,wHour,wMinute,wSecond,wmilliSeconds);
setsystemTime(Tempsystemtime);
end;
修改当前日期
修改当前时间也类似
//==============================================================================
//修正日期、时间****************************************************************
//==============================================================================
procedure SetDateTime(DateTime: TDateTime);
var SystemTime: TSystemTime;
begin
DateTimeToSystemTime(DateTime,SystemTime);
SetLocalTime(SystemTime);
end;