by Lateef Khan (1 Submission)
Category: Windows System Services
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Wed 28th June 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Restart Windows using ExitWindowsEx API Call.
API Declarations
Const EWX_REBOOT = 2
Const EWX_LOGOFF = 0
Const EWX_FORCE = 4
Private Declare Function ExitWindowsEx Lib "user32" _
(ByVal uFlags As Long, _
ByVal dwReserved As Long) _
As Long
Private Sub cmdRestart_Click()
'Restart Windows (works on Windows 95/NT)
ExitWindowsEx EWX_LOGOFF, 0
End Sub