hi, i need help on how to shutdown a computer using vb.net, i tried using the code below but it doesnt seem to work. it will only log-off a computer, i want it to shutdown. i hope you guys can help me. tnx.
Public Class Form1
Inherits System.Windows.Forms.Form
Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Integer, ByVal dwReserved As Integer) As Integer
Public Const EWX_POWEROFF As Short = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim lresult As Object
lresult = ExitWindowsEx(EWX_POWEROFF, 0)
End Sub
End Class
Public Class Form1
Inherits System.Windows.Forms.Form
Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Integer, ByVal dwReserved As Integer) As Integer
Public Const EWX_POWEROFF As Short = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim lresult As Object
lresult = ExitWindowsEx(EWX_POWEROFF, 0)
End Sub
End Class