Hi all,
I'm trying to create an app that will reboot the machine upon which it is
running. I've set up ExitWindowsEx as shown below, but I seem to have done
something wrong, as nothing happens when the button associated with the
reboot command is pushed.
From what I can see of the code I have googled, the syntax looks right.
Would someone please give me a nudge in the right direction?
Thank you.
Public Class Form1
Inherits System.Windows.Forms.Form
Const EWX_REBOOT = 2
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As
Long, _
ByVal dwReserved As Long) As Long
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim lr As Long
lr& = ExitWindowsEx(EWX_REBOOT, 0)
MsgBox(lr)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
End
End Sub
End Class