98系统想取得服务器的当前时间,怎样写?(100分)

  • 主题发起人 主题发起人 catcherye
  • 开始时间 开始时间
C

catcherye

Unregistered / Unconfirmed
GUEST, unregistred user!
98系统想取得服务器的当前时间,怎样写?以下错误怎样解决?<br><br>连接文件hh.exe到不存在的输出 NETAPI32.DLL:NetApiBufferFree<br><br>Unable to create process: 与系统连接的设备不能正常运转。
 
Dll 设置有误<br>检查一下,external是否正确!
 
PTime_Of_Day_Info = ^TTime_Of_Day_Info;<br>&nbsp; TTime_Of_Day_Info = record<br>&nbsp; &nbsp; tod_elapsedt &nbsp;:Integer;<br>&nbsp; &nbsp; tod_msecs &nbsp; &nbsp; :Integer;<br>&nbsp; &nbsp; tod_hours &nbsp; &nbsp; :Integer;<br>&nbsp; &nbsp; tod_mins &nbsp; &nbsp; &nbsp;:Integer;<br>&nbsp; &nbsp; tod_secs &nbsp; &nbsp; &nbsp;:Integer;<br>&nbsp; &nbsp; tod_hunds &nbsp; &nbsp; :Integer;<br>&nbsp; &nbsp; tod_timezone &nbsp;:LongInt;<br>&nbsp; &nbsp; tod_tinterval :Integer;<br>&nbsp; &nbsp; tod_day &nbsp; &nbsp; &nbsp; :Integer;<br>&nbsp; &nbsp; tod_month &nbsp; &nbsp; :Integer;<br>&nbsp; &nbsp; tod_year &nbsp; &nbsp; &nbsp;:Integer;<br>&nbsp; &nbsp; tod_weekday &nbsp; :Integer;<br>&nbsp; end;<br><br>function NetRemoteTOD(ServerName :PWideChar;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var buffer :pointer) :Integer; stdcall; external 'netapi32.dll';<br><br>function NetApiBufferFree(buffer : Pointer) :Integer; stdcall; external 'netapi32.dll';<br><br>function TNTRemoteDateTime.GetTOD(ServerName: WideString): Integer;<br>var Buffer &nbsp; &nbsp; :pointer;<br>&nbsp; &nbsp; Rek &nbsp; &nbsp; &nbsp; &nbsp;:PTime_Of_Day_Info;<br>&nbsp; &nbsp; ADate &nbsp; &nbsp; &nbsp;:TDateTime;<br>&nbsp; &nbsp; ATime &nbsp; &nbsp; &nbsp;:TDateTime;<br>&nbsp; &nbsp; FinalTime &nbsp;:TDateTime;<br>&nbsp; &nbsp; THours,<br>&nbsp; &nbsp; TMins,<br>&nbsp; &nbsp; TSecs,<br>&nbsp; &nbsp; TMSecs &nbsp; &nbsp; :Word;<br>&nbsp; &nbsp; TYear,<br>&nbsp; &nbsp; TMonth,<br>&nbsp; &nbsp; TDay &nbsp; &nbsp; &nbsp; :Word;<br>begin<br><br>&nbsp; result:=NetRemoteTOD(PWideChar(ServerName),<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Buffer);<br>&nbsp; if result=0 then<br>&nbsp; begin<br>&nbsp; &nbsp; Rek:=PTime_Of_Day_Info(Buffer);<br>&nbsp; &nbsp; FServerName :=ServerName;<br>&nbsp; &nbsp; FElapseDt &nbsp; :=Rek.tod_elapsedt;<br>&nbsp; &nbsp; FMSecs &nbsp; &nbsp; &nbsp;:=Rek.tod_msecs;<br>&nbsp; &nbsp; FHours &nbsp; &nbsp; &nbsp;:=Rek.tod_hours;<br>&nbsp; &nbsp; FMins &nbsp; &nbsp; &nbsp; :=Rek.tod_mins;<br>&nbsp; &nbsp; FSecs &nbsp; &nbsp; &nbsp; :=Rek.tod_secs;<br>&nbsp; &nbsp; FHunds &nbsp; &nbsp; &nbsp;:=Rek.tod_hunds;<br>&nbsp; &nbsp; FTInterval &nbsp;:=Rek.tod_tinterval;<br><br>&nbsp; &nbsp; If Rek.tod_timezone &lt;&gt; -1 then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; FTimeZone:=Rek.tod_timezone div 60;<br>&nbsp; &nbsp; end<br>&nbsp; &nbsp; else<br>&nbsp; &nbsp; &nbsp; FTimeZone:=0;<br><br>&nbsp; &nbsp; FDay &nbsp; &nbsp; &nbsp; &nbsp;:=Rek.tod_day;<br>&nbsp; &nbsp; FMonth &nbsp; &nbsp; &nbsp;:=Rek.tod_month;<br>&nbsp; &nbsp; FYear &nbsp; &nbsp; &nbsp; :=Rek.tod_year;<br>&nbsp; &nbsp; FWeekDay &nbsp; &nbsp;:=Rek.tod_weekday;<br><br>&nbsp; &nbsp; ADate:=EncodeDate(FYear, FMonth, FDay);<br>&nbsp; &nbsp; ATime:=EnCodeTime(FHours, FMins, FSecs, FHunds);<br><br>&nbsp; &nbsp; FinalTime:=StrToDateTime(DateTimeToStr(ADate) + ' ' + TimeToStr(ATime));<br>&nbsp; &nbsp; FinalTime:=FinalTime - (FTimeZone / 24);<br><br>&nbsp; &nbsp; decodetime(FinalTime,THours, TMins,TSecs, TSecs);<br><br>&nbsp; &nbsp; FHours:=Integer(THours);<br><br>&nbsp; &nbsp; decodeDate(FinalTime,TYear, TMonth,TDay);<br>&nbsp; &nbsp; FYear:=Integer(TYear);<br>&nbsp; &nbsp; FMonth:=Integer(TMonth);<br>&nbsp; &nbsp; FDay:=Integer(TDay);<br><br>&nbsp; end;<br>&nbsp; NetApiBufferFree(Buffer);<br>end;<br><br>
 
请问一下如果取回来的时间是否是支持中国的时间段的?
 
是98系统,哪有这个函数啊。<br>
 
后退
顶部