Declare
Declare Function ExitWindows Lib "User" (ByVal RestartCode As Long, _
ByVal DOSReturnCode As Integer) As Integer
Code
Sub ExitWin (ByVal nExitOption As Integer) Dim n As Integer
n = MsgBox("Do you really want to exit Windows?", 36, "Exiting")
If n = 7 Then Exit Sub 'User chose NO
Select Case nExitOption
Case 1
n = ExitWindows(67, 0) 'reboot the computer
Case 2
n = ExitWindows(66, 0) 'restart Windows
Case 3
n = ExitWindows(0, 0) 'exit Windows
End Select
End Sub
Tip By: Brian Simper
Discover more from dotNetTips.com
Subscribe to get the latest posts sent to your email.
