Wolfsnap
Member
I need to able to shut down Windows 2000 in VB.net. Im developing an application that will run on an industrial PC interface controlling a piece of machinery in a truck. When a "job" is complete, I need to shut down the interface to avoid corrupting the OS and systems on the PC (as opposed to the operator just cutting the power).
Ive got this code so far, which allows me to restart and log off, but it wont work for a full shutdown.
I think that I need to set some sort of permissions or authorizations to do a full shutdown, but I am having no luck finding a working example to achieve this.
Any help would me EXTREMELY appreciated!
Wolf
Ive got this code so far, which allows me to restart and log off, but it wont work for a full shutdown.
Code:
Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Integer, ByVal dwReserved As Integer) As Integer
Declarations
Public Enum ExitWindowsFlags
EWX_LOGOFF = 0
EWX_REBOOT = 2
EWX_SHUTDOWN = 1
EWX_FORCE = 4
End Enum
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ExitWindows(0)
End Sub
I think that I need to set some sort of permissions or authorizations to do a full shutdown, but I am having no luck finding a working example to achieve this.
Any help would me EXTREMELY appreciated!
Wolf
Last edited by a moderator: