Make your own free website on

Reboot/Shutdown Windows

'Add a module to your project (In the menu choose Project -> Add Module, Then click Open)
'Add 1 CommandButton to your form (named Command1).
'When you will press the button your computer will rebooted.
'Insert this code to the module :

Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, _
ByVal dwReserved As Long) As Long

'Insert this code to your form:

Private Sub Command1_Click()
'Replace EWX_REBOOT with the following options:
'EWX_FORCE—Forcibly terminates processes that do not respond.
'EWX_LOGOFF—Terminates processes, then logs off.
'EWX_SHUTDOWN—Powers the system off, if possible.
'EWX_REBOOT—Reboots the system.
'EWX_SHUTDOWN—Shuts the system down.

ExitWindowsEx EWX_REBOOT, 0
Unload Me
End Sub

Go Back