> >Function SetSystemDate > Lparameters tdDate > Declare Integer SetLocalTime In win32api String @ lpTime > Declare Integer GetLocalTime In win32api String @ lpTime > Local lpCurrent, lcNewTime > lpCurrent = Space(40) > GetLocalTime(@lpCurrent) && save current > > lcNewTime = Num2Word(Year(m.tdDate))+; > Num2Word(Month(m.tdDate))+; > Num2Word(Dow(m.tdDate))+; > Num2Word(Day(m.tdDate))+; > Substr(m.lpCurrent,9) > > SetLocalTime(@lcNewTime) > SetLocalTime(@lcNewTime) > >EndFunc > >Function Num2Word > Lparameters tnDecimal > Return Chr(m.tnDecimal%256)+Chr(Int(m.tnDecimal/256)) >EndFunc > > >>
Function SetTime(tnYear, tnMonth, tnDay, tnHours, tnMinutes, tnSeconds, tnMilliseconds) *!* SetTime(tDateTime) *!* SetTime(nYear, nMonth, nDay, nHours, nMinutes, nSeconds [, nMilliseconds] *!* SetLocalTime Function *!* _http://msdn.microsoft.com/en-us/library/ms724936(VS.85).aspx *!* SYSTEMTIME Structure *!* _http://msdn.microsoft.com/en-us/library/ms724950(VS.85).aspx *!* WM_TIMECHANGE Message *!* _http://msdn.microsoft.com/en-us/library/ms725498.aspx *!* typedef struct _SYSTEMTIME { *!* WORD wYear; *!* WORD wMonth; *!* WORD wDayOfWeek; *!* WORD wDay; *!* WORD wHour; *!* WORD wMinute; *!* WORD wSecond; *!* WORD wMilliseconds; *!* "The wDayOfWeek member of the SYSTEMTIME structure is ignored." Local ltDateTime As Datetime, lcVartypes As String, lcSystemTime As String, lnRetVal As Integer If Vartype(m.tnYear) = "T" Then m.ltDateTime = m.tnYear m.tnYear = Year(m.ltDateTime) m.tnMonth = Month(m.ltDateTime) m.tnDay = Day(m.ltDateTime) m.tnHours = Hour(m.ltDateTime) m.tnMinutes = Minute(m.ltDateTime) m.tnSeconds = Sec(m.ltDateTime) m.tnMilliseconds = 0 Else m.lcVartypes = ; Vartype(m.tnYear) + ; Vartype(m.tnMonth) + ; Vartype(m.tnDay) + ; Vartype(m.tnHours) + ; Vartype(m.tnMinutes) + ; Vartype(m.tnSeconds) If m.lcVartypes # "NNNNNN" Then Return .F. Endif If Vartype(m.tnMilliseconds) # "N" Then m.tnMilliseconds = 0 Endif Endif Declare Integer SetLocalTime In win32api As apiSetLocalTime; String lpSystemTime m.lcSystemTime = ; Bintoc(m.tnYear, "2rs") + ; Bintoc(m.tnMonth, "2rs") + ; Bintoc(0, "2rs") + ; Bintoc(m.tnDay, "2rs") + ; Bintoc(m.tnHours, "2rs") + ; Bintoc(m.tnMinutes, "2rs") + ; Bintoc(m.tnSeconds, "2rs") + ; Bintoc(m.tnMilliseconds, "2rs") m.lnRetVal = apiSetLocalTime(m.lcSystemTime) Return m.lnRetVal # 0 EndfuncCarlos Alloatti