compA to tell compB to start/exit program using Vb.net and WMI

remya1000

Well-known member
Joined
Mar 29, 2007
Messages
122
Programming Experience
Beginner
i need computer A to tell computer B to start or Exit a program. and computer B should do Exit or start while computer A gives start or exit direction.
i'm using VB.NET and WMI. and i'm new to WMI. i dont have anyidea how computer A and connect to computer B.
any idea how can i do this.
if you have any idea please help me.
thanks in advance
 
instead of Local machine whether i can connect to Remote machine.

i just created a combobox and inside that i have "localhost" and remote machine eg:"a1".
if selected is localhost, it will connect. but if the selected item is a1(remote machine) it's not connecting.
this the code i'm using....

SEND
VB.NET:
Private Sub frmSend_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
comboBoxIP.Items.Add("localhost")
comboBoxIP.Items.Add("a1")
End Sub

Private Sub cmdConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdConnect.Click
wsSend.Close()
wsSend.Connect(comboBoxIP.Text, 1223) 
End Sub

Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
wsSend.SendData(txtSendWhat.Text)
End Sub
RECEIVE
VB.NET:
Private Sub frmSend_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim frmReceive As New frmReceive
frmReceive.Show()
wsReceive.Close()
wsReceive.LocalPort = 1223
'wsReceive.RemotePort = 1223 
wsReceive.Listen()
End Sub 

Private Sub wsReceive_ConnectionRequest(ByVal sender As Object, ByVal e As AxMSWinsockLib.DMSWinsockControlEvents_ConnectionRequestEvent) Handles wsReceive.ConnectionRequest
If wsReceive.CtlState <> MSWinsockLib.StateConstants.sckClosed Then
wsReceive.Close()
End If

wsReceive.Accept(e.requestID)

If wsReceive.CtlState = MSWinsockLib.StateConstants.sckConnected Then
Call wsReceiveConnected()
End If
End Sub

Private Sub wsReceive_DataArrival(ByVal sender As Object, ByVal e As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles wsReceive.DataArrival
Dim str As String
wsReceive.GetData(str, vbString)
txtMessageReceived.Text = str
End Sub
if i need to connect to a remote machine, what is the change i need to do in this code. i'm not getting anyidea.... if you know how to do that please let me know .
thanks in advance and thanks for your post and link.. its very usefull for me...
 
Last edited by a moderator:
Back
Top