Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Program closing causes reboot

Status
Not open for further replies.

TDogg

MIS
Dec 11, 2000
11
US
How can i make a program reboot windows as soon as a specified program closes?
 
'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


Eric De Decker
vbg.be@vbgroup.nl

Licence And Copy Protection AxtiveX
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top