PDA

Click to See Complete Forum and Search --> : Restart Without Prompt


Civil78
Jan 22nd, 2000, 03:32 AM
I have a problem ... i want to restart my computer when the widnows stuck...and i can't do anything...
I have make a program that can restart your computer but windows responce a message to end task some programs.
How can i make the end task automatically and restart the computer.
This solves my problem to make reboot to a host computer that is away from me and i get in with Pc-Anywere 9.0.

CyberCarsten
Jan 22nd, 2000, 05:10 AM
Add a module to the project and type:

Option Explicit
Declare Function ExitWindowsEx Lib "user32" Alias "ExitWindowsEx" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long

Public Const EWX_REBOOT = 1

Add the following code to Form1

Private Sub Form_Load()
Call ExitWindowsEx(EWX_REBOOT, 1)
End Sub


------------------
Yours sincierly
CyberCarsten http://home18.inet.tele.dk/cyber/
carsten.h.thomsen@mail.tele.dk


[This message has been edited by CyberCarsten (edited 01-22-2000).]

rino_2
Jan 22nd, 2000, 05:18 AM
Hi,

I just added all this code to my form:

-----------------------------------------
Private Declare Function ExitWindowsEx Lib "Kernel32" (Byval uFlags as Long, Byval dwReserved as long) As Long

'Add this to an event..
ExitWindowsEx EWX_REBOOT Or EWX_FORCE, 0
-----------------------------------------

hope it helps!