|
Данный пример установит новое время на
компьютере. Для установления новой даты на
компьютере, снимите комментарии в функции SetNewTime.
Одна проблема: после выполнения кода, не
происходит обновления времени в SystemTray. Если кто
знает, как обновить время в SysTray, то напишите ведущему раздела. Private Type SystemTime
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Private Declare Function SetLocalTime Lib "kernel32.dll" (lpSystemTime As
SystemTime) As Long
Public Sub SetNewTime(NewHour As Integer, NewMinute As Integer, NewSecond As Integer)
Dim SetTime As SystemTime
Dim RetVal As Long
SetTime.wHour = NewHour
SetTime.wMinute = NewMinute
SetTime.wSecond = NewSecond
SetTime.wMilliseconds = 0
SetTime.wDay = Day(Date)
'SetTime.wDay = 14
SetTime.wMonth = Month(Date)
'SetTime.wMonth = 3
SetTime.wYear = Year(Date)
'SetTime.wYear = 1997
RetVal = SetLocalTime(SetTime)
End Sub
Private Sub Command1_Click()
Call SetNewTime(13, 20, 50)
End Sub
|
|