Home
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
 
 
 
 
TitleShutdown or restart Windows using ExitWindowsEx
Keywordsshutdown, restart
CategoriesWindows
 
Use the ExitWindowsEx API function.
 
Private Sub cmdShutdown_Click()
Dim flags As Long

    If optCommand(0).Value Then
        flags = EWX_LOGOFF
    ElseIf optCommand(1).Value Then
        flags = EWX_POWEROFF
    ElseIf optCommand(2).Value Then
        flags = EWX_REBOOT
    Else
        flags = EWX_SHUTDOWN
    End If

    If optOption(0).Value Then
        ' No options.
    ElseIf optOption(1).Value Then
        flags = flags + EWX_FORCE
    Else
        flags = flags + EWX_FORCEIFHUNG
    End If

    ExitWindowsEx flags, 0
End Sub
 
 
Copyright © 1997-2001 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated