Option Explicit
Dim WinD As String
Private Sub Command1_Click()
'電源断
Dim AutoOff
AutoOff = Shell(WinD + "\RUNDLL.EXE user.exe,exitwindows")
Unload Me
Set Form1 = Nothing
End Sub
Private Sub Command2_Click()
'再起動
Dim AutoOff
AutoOff = Shell(WinD + "\RUNDLL.EXE user.exe,exitwindowsexec")
Unload Me
Set Form1 = Nothing
End Sub
Private Sub Form_Load()
Dim CmdLine As String
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
CmdLine = Right(Command(), 1)
WinD = Environ("WINDIR")
Select Case CmdLine
Case "1"
'Form表示
Case "2"
'再起動
Command2.Value = True
Case Else
'電源断
Command1.Value = True
End Select
End Sub
End Function