我用NMTime组件实现了,却发现NMTime组件有bug,无法关机!
请问谁有可以用的代码?请贴出来,谢谢!

解决方案 »

  1.   

    win2000里面自己可以根据域服务器校时的。
      

  2.   

    function TfrmMain.fcGetDateTime: Boolean;
    var
      SysTime: TSystemTime;
      DateTimeStr: string;
    begin
      try
          NMDayTime.ReportLevel := Status_Basic;
          NMDayTime.TimeOut := 500;
          NMDayTime.Host := '192.43.244.18';
          NMDayTime.Port := 13;
          DateTimeStr := NMDayTime.DayTimeStr;
          DateTimeStr := Trim(Copy(DateTimeStr,7,32));      //18
          with SysTime do
          begin
              wYear := 2000 + StrToInt(Copy(DateTimeStr,1,2));
              wMonth := StrToInt(Copy(DateTimeStr,4,2));
              wDay := StrToInt(Copy(DateTimeStr,7,2));
              wHour := StrToInt(Copy(DateTimeStr,10,2));
              wMinute := StrToInt(Copy(DateTimeStr,13,2));
              wSecond := StrToInt(Copy(DateTimeStr,16,2));
              wMilliseconds := StrToInt(Copy(DateTimeStr,26,3));
          end;
          if SetSystemTime(SysTime) then
            Result:=True
          else
            Result:=False;
      except
          Result:=False;
      end;
    end;NMDayTime组件有严重的Bug!