by Abid Khurshid Butt (2 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 3.0
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating: (9 Votes)
With this code your can Shutdown any Workstation connected on LAN (Local Area Network) od Windows NT/2000.
This code is very usefull for LAN applications. It will give an good idea to communicate with other worstations.
Inputs
Just Workstation Name to Shutdown
Assumes
User must know something about Windows API and some knowledge of Network.
Code Returns
Required Workstation will Shutdown
Side Effects
There no side effects for this code.
API DeclarationsPrivate Declare Function InitiateSystemShutdown Lib "advapi32.dll" Alias "InitiateSystemShutdownA" (ByVal lpMachineName As String, ByVal lpMessage As String, ByVal dwTimeout As Long, ByVal bForceAppsClosed As Long, ByVal bRebootAfterShutdown As Long) As Long
Private Sub Command1_Click()
Dim a
a = InitiateSystemShutdown(Trim(Text1.Text), "Hello", 0, 0, 1)
MsgBox "Shutdown Completed"
End Sub