Results 1 to 2 of 2

Thread: Shutting Down windows- using API

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2002
    Posts
    9

    Exclamation Shutting Down windows- using API

    Would like to get some code on how to shutdown windows using the API.

    Thanks

  2. #2
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    For Win9x family =
    Code:
    Const EWX_LOGOFF = 0
    Const EWX_SHUTDOWN = 1
    Const EWX_REBOOT = 2
    Const EWX_FORCE = 4
    Private Declare Function ExitWindowsEx Lib "user32" (ByVal  _
    uFlags As Long, ByVal dwReserved As Long) As Long
    
    Private Sub Form_Load()
        msg = MsgBox("This program is going to reboot your computer. Press OK to continue or Cancel to stop.", vbCritical + vbOKCancel + 256, App.Title)
        If msg = vbCancel Then End
        'reboot the computer
        ret& = ExitWindowsEx(EWX_FORCE Or EWX_REBOOT, 0)
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width