⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form2.frm

📁 桌面时钟小程序源码
💻 FRM
📖 第 1 页 / 共 2 页
字号:

If t1a > 24 Then
t1a = t1a - 24
str1(2) = Trim(Str(t1a))
Else
str1(2) = Trim(Str(t1a))
End If
time1 = str1(2) & ":" & str1(1) & ":" & str1(0)


End If
If Check1.Value = 1 Then
If Option1(0).Value = True Then
If Int(Combo2.Text) - Int(Text1.Text) < 0 Then
time2 = Trim(Str(Int(Combo1.Text) - 1)) & ":" & Trim(Str(60 + Int(Combo2.Text) - Int(Text1.Text))) & ":" & Trim(Combo3.Text)
Else
time2 = Trim(Combo1.Text) & ":" & Trim(Str(Int(Combo2.Text) - Int(Text1.Text))) & ":" & Trim(Combo3.Text)
End If
Else
If Int(Trim(Str(60 + Int(Minute(Time())) + Int(Combo2.Text) - Int(Text1.Text)))) - Int(Text1.Text) < 0 Then
time2 = Trim(Str(Int(Hour(Time())) + Int(Combo1.Text) - 1)) & ":" & Trim(Str(60 + Int(Minute(Time())) + Int(Combo2.Text) - Int(Text1.Text))) & ":" & Trim(Str(Int(Second(Time())) + Int(Combo3.Text)))
Else
time2 = Trim(Str(Int(Hour(Time())) + Int(Combo1.Text))) & ":" & Trim(Str(Int(Minute(Time())) + Int(Combo2.Text) - Int(Text1.Text))) & ":" & Trim(Str(Int(Second(Time())) + Int(Combo3.Text)))
End If
End If
End If

If Option1(0).Value = True Then
ta = Int(Hour(Time()))
tb = Int(Minute(Time()))
tc = Int(Second(Time()))
ta = Int(Combo1.Text) - ta
tb = Int(Combo2.Text) - tb
tc = Int(Combo3.Text) - tc
If tc < 0 Then
tc = tc + 60
tb = tb - 1
End If
If tb < 0 Then
tb = tb + 60
ta = ta - 1
End If
If ta < 0 Then
ta = ta + 24
End If
bktime = Int(ta) * 3600 + Int(tb) * 60 + Int(tc)
Else
bktime = Int(Combo1.Text) * 3600 + Int(Combo2.Text) * 60 + Int(Combo3.Text)
End If
opt = 1
Timer1.Enabled = True
Timer2.Enabled = True
If Check2.Value = 1 Then

Form2.Option1(0).Enabled = False
Form2.Option1(1).Enabled = False
Form2.Command1.Enabled = False
Form2.Command2.Enabled = False
Form2.Command3.Enabled = False
Form2.Command4.Enabled = False
End If
Form2.Caption = "系统在" & time1 & "重启"

End Sub

Private Sub Command3_Click()
If Option1(0).Value = True Then
t1a = Int(Combo1.Text)
t1b = Int(Combo2.Text)
t1c = Int(Combo3.Text)
If t1c < 10 Then
str1(0) = "0" & Trim(Str(t1c))
Else
str1(0) = Trim(Str(t1c))
End If
If t1b < 10 Then
str1(1) = "0" & Trim(Str(t1b))
Else
str1(1) = Trim(Str(t1b))
End If

str1(2) = Trim(Str(t1a))

time1 = str1(2) & ":" & str1(1) & ":" & str1(0)
Else
t1a = Int(Combo1.Text)
t1b = Int(Combo2.Text)
t1c = Int(Combo3.Text)
t1a = t1a + Int(Hour(Time()))

t1b = t1b + Int(Minute(Time()))
t1c = t1c + Int(Second(Time()))
If t1c > 60 Then
t1c = t1c - 60
t1b = t1b + 1
End If
If t1b > 60 Then
t1b = t1b - 60
t1a = t1a + 1
End If
If t1a > 24 Then
t1a = t1a - 24
End If
If t1c < 10 Then
str1(0) = Trim("0" & Str(t1c))
Else
str1(0) = Trim(Str(t1c))
End If
If t1b < 10 Then
str1(1) = Trim("0" & Str(t1b))
Else
str1(1) = Trim(Str(t1b))
End If

If t1a > 24 Then
t1a = t1a - 24
str1(2) = Trim(Str(t1a))
Else
str1(2) = Trim(Str(t1a))
End If
time1 = str1(2) & ":" & str1(1) & ":" & str1(0)


End If
If Check1.Value = 1 Then
If Option1(0).Value = True Then
If Int(Combo2.Text) - Int(Text1.Text) < 0 Then
time2 = Trim(Str(Int(Combo1.Text) - 1)) & ":" & Trim(Str(60 + Int(Combo2.Text) - Int(Text1.Text))) & ":" & Trim(Combo3.Text)
Else
time2 = Trim(Combo1.Text) & ":" & Trim(Str(Int(Combo2.Text) - Int(Text1.Text))) & ":" & Trim(Combo3.Text)
End If
Else
If Int(Trim(Str(60 + Int(Minute(Time())) + Int(Combo2.Text) - Int(Text1.Text)))) - Int(Text1.Text) < 0 Then
time2 = Trim(Str(Int(Hour(Time())) + Int(Combo1.Text) - 1)) & ":" & Trim(Str(60 + Int(Minute(Time())) + Int(Combo2.Text) - Int(Text1.Text))) & ":" & Trim(Str(Int(Second(Time())) + Int(Combo3.Text)))
Else
time2 = Trim(Str(Int(Hour(Time())) + Int(Combo1.Text))) & ":" & Trim(Str(Int(Minute(Time())) + Int(Combo2.Text) - Int(Text1.Text))) & ":" & Trim(Str(Int(Second(Time())) + Int(Combo3.Text)))
End If
End If
End If

If Option1(0).Value = True Then
ta = Int(Hour(Time()))
tb = Int(Minute(Time()))
tc = Int(Second(Time()))
ta = Int(Combo1.Text) - ta
tb = Int(Combo2.Text) - tb
tc = Int(Combo3.Text) - tc
If tc < 0 Then
tc = tc + 60
tb = tb - 1
End If
If tb < 0 Then
tb = tb + 60
ta = ta - 1
End If
If ta < 0 Then
ta = ta + 24
End If
bktime = Int(ta) * 3600 + Int(tb) * 60 + Int(tc)
Else
bktime = Int(Combo1.Text) * 3600 + Int(Combo2.Text) * 60 + Int(Combo3.Text)
End If
opt = 3
Timer1.Enabled = True
Timer2.Enabled = True
If Check2.Value = 1 Then
Form2.Option1(0).Enabled = False
Form2.Option1(1).Enabled = False
Form2.Command1.Enabled = False
Form2.Command2.Enabled = False
Form2.Command3.Enabled = False
Form2.Command4.Enabled = False
End If
Form2.Caption = "系统在" & time1 & "强行关闭"
End Sub

Private Sub Command4_Click()
If Option1(0).Value = True Then
t1a = Int(Combo1.Text)
t1b = Int(Combo2.Text)
t1c = Int(Combo3.Text)
If t1c < 10 Then
str1(0) = "0" & Trim(Str(t1c))
Else
str1(0) = Trim(Str(t1c))
End If
If t1b < 10 Then
str1(1) = "0" & Trim(Str(t1b))
Else
str1(1) = Trim(Str(t1b))
End If

str1(2) = Trim(Str(t1a))

time1 = str1(2) & ":" & str1(1) & ":" & str1(0)
Else
t1a = Int(Combo1.Text)
t1b = Int(Combo2.Text)
t1c = Int(Combo3.Text)
t1a = t1a + Int(Hour(Time()))

t1b = t1b + Int(Minute(Time()))
t1c = t1c + Int(Second(Time()))
If t1c > 60 Then
t1c = t1c - 60
t1b = t1b + 1
End If
If t1b > 60 Then
t1b = t1b - 60
t1a = t1a + 1
End If
If t1a > 24 Then
t1a = t1a - 24
End If
If t1c < 10 Then
str1(0) = Trim("0" & Str(t1c))
Else
str1(0) = Trim(Str(t1c))
End If
If t1b < 10 Then
str1(1) = Trim("0" & Str(t1b))
Else
str1(1) = Trim(Str(t1b))
End If

If t1a > 24 Then
t1a = t1a - 24
str1(2) = Trim(Str(t1a))
Else
str1(2) = Trim(Str(t1a))
End If
time1 = str1(2) & ":" & str1(1) & ":" & str1(0)


End If
If Check1.Value = 1 Then
If Option1(0).Value = True Then
If Int(Combo2.Text) - Int(Text1.Text) < 0 Then
time2 = Trim(Str(Int(Combo1.Text) - 1)) & ":" & Trim(Str(60 + Int(Combo2.Text) - Int(Text1.Text))) & ":" & Trim(Combo3.Text)
Else
time2 = Trim(Combo1.Text) & ":" & Trim(Str(Int(Combo2.Text) - Int(Text1.Text))) & ":" & Trim(Combo3.Text)
End If
Else
If Int(Trim(Str(60 + Int(Minute(Time())) + Int(Combo2.Text) - Int(Text1.Text)))) - Int(Text1.Text) < 0 Then
time2 = Trim(Str(Int(Hour(Time())) + Int(Combo1.Text) - 1)) & ":" & Trim(Str(60 + Int(Minute(Time())) + Int(Combo2.Text) - Int(Text1.Text))) & ":" & Trim(Str(Int(Second(Time())) + Int(Combo3.Text)))
Else
time2 = Trim(Str(Int(Hour(Time())) + Int(Combo1.Text))) & ":" & Trim(Str(Int(Minute(Time())) + Int(Combo2.Text) - Int(Text1.Text))) & ":" & Trim(Str(Int(Second(Time())) + Int(Combo3.Text)))
End If
End If
End If

If Option1(0).Value = True Then
ta = Int(Hour(Time()))
tb = Int(Minute(Time()))
tc = Int(Second(Time()))
ta = Int(Combo1.Text) - ta
tb = Int(Combo2.Text) - tb
tc = Int(Combo3.Text) - tc
If tc < 0 Then
tc = tc + 60
tb = tb - 1
End If
If tb < 0 Then
tb = tb + 60
ta = ta - 1
End If
If ta < 0 Then
ta = ta + 24
End If
bktime = Int(ta) * 3600 + Int(tb) * 60 + Int(tc)
Else
bktime = Int(Combo1.Text) * 3600 + Int(Combo2.Text) * 60 + Int(Combo3.Text)
End If
opt = 4
Timer1.Enabled = True
Timer2.Enabled = True

If Check2.Value = 1 Then
Form2.Option1(0).Enabled = False
Form2.Option1(1).Enabled = False
Form2.Command1.Enabled = False
Form2.Command2.Enabled = False
Form2.Command3.Enabled = False
Form2.Command4.Enabled = False
End If
Form2.Caption = "系统在" & time1 & "注销"
End Sub

Private Sub Command5_Click()
Form2.Hide
End Sub

Private Sub Form_Load()
 MyMenu = GetSystemMenu(Me.hWnd, 0)
 RemoveMenu MyMenu, &HF060, MF_BYCOMMAND
 
Form2.Left = (Screen.Width - 5025) / 2
Form2.Top = (Screen.Height - 2235) / 2

For i = 0 To 23
Form2.Combo1.AddItem i
Next
For i = 0 To 59
Form2.Combo2.AddItem i
Next
For i = 0 To 59
Form2.Combo3.AddItem i
Next
Form2.Combo3.ListIndex = 0
Form2.Combo1.ListIndex = 1
Form2.Combo2.ListIndex = 0


End Sub

Private Sub nonbacktime_Click()
CoolTime.Height = 307
End Sub

Private Sub nonenotify_Click()
Form2.Check1.Value = vbUnchecked
End Sub

Private Sub notyfy_Click()
Form2.Check1.Value = 1
End Sub

Private Sub Option1_Click(Index As Integer)
If Index = 0 Then
Option1(1).Value = False
Option1(0).Value = True
Option1(1).ForeColor = vbBlack
Option1(0).ForeColor = vbRed
Label2.Caption = "点"
Label3.Caption = "分"
Label5.Caption = "秒时"
Else
Option1(0).Value = False
Option1(1).Value = True
Option1(0).ForeColor = vbBlack
Option1(1).ForeColor = vbRed
Label2.Caption = "小时"
Label3.Caption = "分钟"
Label5.Caption = "秒后"
End If
End Sub

Private Sub set_Click()
Form2.Show
End Sub

Private Sub Timer1_Timer()

ntm = Trim(Str(Time()))
If Mid(ntm, 1, 2) = "下午" Or Mid(ntm, 1, 2) = "上午" Then
If (Mid(ntm, 1, 2) = "下午") Then
ntm3 = ntm
ntm2 = Mid(ntm, 4, 2)
ntm = Trim(Str((Int(ntm2) + 12)))
ntm2 = Mid(ntm3, 6)
ntm = ntm & ntm2
Else
ntm = Mid(ntm, 4)
End If
    Text3.Text = time1 & " " & ntm
    If time1 = ntm Then
    Select Case opt
    Case 1:
    lngresult = ExitWindowsEx(EWX_REBOOT, 0)
    End
    Case 2:

    lngresult = ExitWindowsEx(EWX_SHUTDOWN, 0&)
    End
    Case 3:
    lngResubl = ExitWindowsEx(EWX_POWEROFF, 0)
    End
    Case 4:
    lngResubl = ExitWindowsEx(EWX_LOGOFF, 0)
    End
    End Select
    End If
    Else
    Text3.Text = time1 & " " & ntm
    If time1 = ntm Then
    Select Case opt
    Case 1:

    lngresult = ExitWindowsEx(EWX_REBOOT, 0)
    
    End
    Case 2:

    lngresult = ExitWindowsEx(EWX_SHUTDOWN, 0&)
    End
    Case 3:
    lngResubl = ExitWindowsEx(EWX_POWEROFF, 0)
    End
    Case 4:
    lngResubl = ExitWindowsEx(EWX_LOGOFF, 0)
    End
    End Select
    End If
End If


If Form2.Check1.Value = 1 Then
If time2 = Str(Time()) Then
Form3.Label1.Caption = "离关闭时间还有" & Text1.Text & "分钟" & "请保存好数据"
Form3.Show
Form3.SetFocus
End If
End If

End Sub

Private Sub Timer2_Timer()
If strpd = Str(Time()) Then
Else
strpd = Trim(Str(Time()))
bktime = bktime - 1
Text2.Text = bktime
CoolTime.Label1.Caption = "还有" & Trim(Str(bktime)) & "秒"
End If
If bktime = 0 Then
    Select Case opt
    Case 1:
     lngresult = ExitWindowsEx(EWX_REBOOT, 0)
    End
    Case 2:
   lngresult = ExitWindowsEx(EWX_SHUTDOWN, 0&)
    End
    Case 3:
   lngResubl = ExitWindowsEx(EWX_POWEROFF, 0)
    End
    Case 4:
    lngResubl = ExitWindowsEx(EWX_LOGOFF, 0)
    End
    End Select

End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -