Set the system time.

zhaozj2021-02-16  28

Option expedition

Private Declare Sub getSystemTime LIB "Kernel32" (LPSystemTime as systemtime)

Private Declare Function SetSystemTime LIB "Kernel32" (LPSystemTime As SystemTime) AS Long

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 IntegerEnd TypeDim time As SYSTEMTIME

Private Sub Command1_Click () Dim Hour As INTEGERHOUR = TXTTIME (3) - 8 'beijing Time

With time .wyear = txttime (0) .text .wmonth = txttime (1) .text .wday = txttime (2) .text .wHour = Iif (Hour> 0, Hour, Hour 24) 'set universal time .wminute = TXTTIME (4) .text .wsecond = txttime (5) .Textend withsetsystemtime Time End Sub

Private suform_load () getSystemTime Time with time txttime (0) .text = .wyear txttime (1) .text = .wmonth txttime (2) .text = .wday txttime (3) .text = .wHour 8 'beijing Time TXTTIME (4) .text = .wminute txttime (5) .text = .wsecond end with end sub

转载请注明原文地址:https://www.9cbs.com/read-27284.html

New Post(0)