注册 登录
编程论坛 VB6论坛

不久前写的修改系统时间-源码+工具

XMeLoDy 发布于 2007-12-31 15:12, 1120 次点击
只有本站会员才能查看附件,请 登录

源码:
'模块****************************************************
Declare Function SetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME) As Long
Type SYSTEMTIME ' 16 Bytes
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

Public Function SetTime(ByVal sYear As Integer, _
                        ByVal sMonth As Integer, _
                        ByVal sDayW As Integer, _
                        ByVal sDay As Integer, _
                        ByVal sHour As Integer, _
                        ByVal sMin As Integer, _
                        ByVal sSecond As Integer, _
                        ByVal sMill As Integer) As Long
    Dim Syst As SYSTEMTIME
    If sHour < 8 Then '时区不同需要修改
        sHour = sHour + 16
    ElseIf sHour > 8 Then
        sHour = sHour - 8
    End If
    With Syst
   
    .wYear = sYear
    .wMonth = sMonth
    .wDayOfWeek = sDayW
    .wDay = sDay
    .wHour = sHour
    .wMinute = sMin
    .wSecond = sSecond
    .wMilliseconds = sMill
    End With
    SetSystemTime Syst
End Function
'窗体模块***********************************************************

Private Sub Command1_Click()
Dim a As Long
Dim St(5) As Integer
    For i = 0 To 5

        St(i) = Val(Form1.Text1(i))
   
    Next
   
a = SetTime(St(0), St(1), 0, St(2), St(3), St(4), St(5), 0)
'年,月,0,日,时,分钟,秒,0
End Sub

Private Sub Command2_Click()
End
End Sub


Private Sub Form_Load()
Text1(0) = Left(Now, 4)
Text1(1) = Val(Mid(Date, 6, 7))
Text1(2) = Val(Mid(Date, 9, 10))
Text1(3) = Hour(Time)
Text1(4) = Minute(Time)
Text1(5) = Second(Time)

End Sub

Private Sub Label7_Click()
    Shell "explorer [url]http://www.[/url]"
End Sub
3 回复
#2
??2007-12-31 15:39
好东东
#3
e3bnsd2012-12-07 15:08
挺好的。
#4
chenchencxj2013-02-18 16:08
好东西学习了
1