A VC to write a DLL function, once after the call, the inside of the Delphi now time will not change, such as call before: S=FormatDatetime (' yyyy/mm/dd hh: nn: ss ', now) can display the current time, normal call DLL, S always values are the same, but, curiously, internal use Windows API function GetLocalTime SysTime () function can access to change the date of the time, such as: Edit1. Text:=IntToStr (SysTime. WYear) + '/' + IntToStr (SysTime. WMonth) + '/' + IntToStr (SysTime. WDay) + "+ IntToStr (SysTime. WHour) + ', '+ IntToStr (SysTime. WMinute) + ', '+ IntToStr (SysTime. WSecond); Can display normally, but as long as the use of the Delphi SysUtils unit function cannot change, such as EncodeDate DateTimeToStr, etc., in the function value is constant, the students encounter such a situation, locking difficulty in the DLL function have??????
CodePudding user response:
This is what you call API, interfere with the New functions of Delphi, In this way, you can directly use the API function of the system, the time value to be obtained, GetLocalTime (& amp; A price);//get the local time zone corresponding time GetSystemTime (& amp; A price);//get the system time (standard time) green