VB 定时重启,关机,代码

来源:百度知道 编辑:UC知道 时间:2024/05/12 18:23:18
最好是能半小时重启一次的
兄弟们问题还没得到解决,帮忙啊!!!
我是刚入门的菜鸟,希望各位高手们能够说的详细一点,先谢谢各位了!

你以为真的那么简单吗?你连系统函数都没有用就控制系统了,高手!!!
******************************以下是代码:
Option Explicit
Private Const EWX_LogOff As Long = 0
Private Const EWX_SHUTDOWN As Long = 1
Private Const EWX_REBOOT As Long = 2
Private Const EWX_FORCE As Long = 4
Private Const EWX_POWEROFF As Long = 8

Private Declare Function ExitWindowsEx Lib "user32" _
(ByVal dwOptions As Long, _
ByVal dwReserved As Long) As Long

Private Declare Function GetLastError Lib "kernel32" () As Long

Private Type LUID
UsedPart As Long
IgnoredForNowHigh32BitPart As Long
End Type

Private Type LUID_AND_ATTRIBUTES
TheLuid As LUID
Attributes As Long
End Type

Private Type TOKEN_PRIVILEGES
PrivilegeCount As Long
TheLuid As LUID
Attributes As Long
End Type

Private Declare Function GetCurrentProcess Lib "ke