Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Const EWX_REBOOT = 2
Const EWX_SHUTDOWN = 1private sub comand1_click()
  Call ExitWindowsEx(EWX_SHUTDOWN, 0)
end sub

解决方案 »

  1.   

    Declare Function ExitWindowsEx& Lib "User32" (ByVal uFlags&, ByVal dwReserved&)
    Global Const EWX_SHUTDOWN = 1pravite sub command1_click()
    result=ExitWindowsEx(EWX_SHUTDOWN, 0&) '关机
    end sub
      

  2.   

    'In general section
    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()
        'KPD-Team 1998
        'URL: http://www.allapi.net/
        'E-Mail: [email protected]
        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
      

  3.   

    最简单的就是
    shell (rundll.exe user.exe,exitwindowsexec)
      

  4.   

    注意 win2000与 win 9598 的区别。hehe~~
      

  5.   

    98的API函数与2000不一样 98下能关的2000下不一定能