Private Declare Function ExitWindowsEx Lib
Const EWX_FORCE As Short =
Const EWX_LOGOFF As Short =
Const EWX_REBOOT As Short =
Const EWX_SHUTDOWN As Short =
Dim retval As Integer
Const VK_ESCAPE As Short = &H
Private Sub Command
If Option
retval = ExitWindowsEx(EWX_FORCE
ElseIf Option
retval = ExitWindowsEx(EWX_SHUTDOWN
ElseIf Option
retval = ExitWindowsEx(EWX_REBOOT
End If
End Sub
Private Sub Command
Me
End Sub
Private Sub Form
Dim KeyAscii As Short = Asc(eventArgs
If KeyAscii = VK_ESCAPE Then
Me
End If
If KeyAscii =
eventArgs
End If
End Sub
本實例通過使用ExitWindowEx()API函數來達到關機和重新啟動的目的
表
From:http://tw.wingwit.com/Article/program/net/201311/13585.html