I can i restart a computer within a vb program.
Printable View
I can i restart a computer within a vb program.
Code:in a module:
Option Explicit
Public Declare Function ExitWindowsEx Lib "user32" (ByVal _ uFlags As Long, ByVal dwReserved As Long) As Long
Public Const EWX_SHUTDOWN = 1
Public Const EWX_LOGOFF = 0
Public Const EWX_REBOOT = 2
Public Const EWX_FORCE = 4
in a form:
Private Sub Command1_Click()
ExitWindowsEx EWX_REBOOT, 0
End Sub
Vb2000, is there anyway of logging out of a remote PC in VB? Or logging in for that matter?
What I'm looking for is to be able to pass the function a computer on the network and logoff that PC. For example, from Computer 'A' I want to log the user off Computer 'B'.
You would have to set up service on each computer on the network. Then, use the winsock control to allow a Client program to connect to the service and log him of
Use:
Code:ExitWindowsEx (EWX_LOGOFF, 0)