vb关机程序

来源:百度知道 编辑:UC知道 时间:2024/06/04 18:50:29
分为时间模式和递减模式,

时间模式就是可以选择自己规定的日期和时间.然后时间到的话有个1分钟倒计时(没有倒计时也可以),然后自动关机.

递减模式的话,就是几小时之后自动关机.时间一到,,,自动关机..还有个取消按钮.例如你设置6点关机.到5点的时候你点取消,则你要指定6点的时候关机的这个任务取消了.

谁会哦..会的话能不能告诉我Source..

发我E-mail:chenzhuli123@126.com

还是利用timer来判断,然后调用shutdown,写了一点在下面。
nowTime,txtTime,oldTime要自己dim一下
Private Sub Timer1_Timer()
nowTime = Time
If Option1(0).Value Then
If DateDiff("s", nowTime, txtTime) Then
If DateDiff("s", nowTime, txtTime) < 0 Then
If Not ExitWindowsEx(EWX_SHUTDOWN, 0) Then
MsgBox "无法关闭计算机"
End If
End If
ElseIf DateDiff("s", nowTime, oldTime + txtTime) < 0 Then
If Not ExitWindowsEx(EWX_SHUTDOWN, 0) Then
MsgBox "无法关闭计算机"
End If
End If
End If
End Sub

shell shutdown.exe

核心依靠 shutdown.exe这个程序

cmd模式下 shutdown /? 查看一下调用参数

很明白的了

然后用shell去调用