Link to home
Start Free TrialLog in
Avatar of pastiesrus
pastiesrus

asked on

System reboot

i have looked around the net and found a few pieces of code that say it shutsdown the system but not mine.
i have a command button and all i want it to do is reboot the system.

can u help

Pastiesrus
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Can you please show us what you have already attempted to use?
Avatar of pastiesrus
pastiesrus

ASKER

Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Private Const EWX_REBOOT = 2

Private Sub cmdShutDown()
    ExitWindowsEx EWX_REBOOT, 2
End Sub

ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
note to future viewers.

The code i used to reboot was:

Shell ("C:\Windows\System32\Shutdown -r")

Works great

Happy codeing
Just be aware that you are using an external EXE called "shutdown" that may not be present on all systems.

It can be moved or deleted easily.    =)