"ping ip" 可以判断是否在线。 "net send ip 内容" 可以发送消息 编程实现使用 Private Declare Function NetMessageBufferSend Lib "NETAPI32.DLL" (Server As Any, yToName As Byte, yFromName As Any, yMsg As Byte, ByVal lSize As Long) As Long
98接收不到,NT系统需要开MESSAGE服务的机器才收得到,具体用如下代码:Private Declare Function NetMessageBufferSend Lib "NETAPI32.DLL" (Server As Any, yToName As Byte, yFromName As Any, yMsg As Byte, ByVal lSize As Long) As LongPrivate Function SendMsg(sToUser As String, sFromUser As String, sMessage As String) As Boolean
Dim yToName() As Byte Dim yFromName() As Byte Dim yMsg() As Byte Dim l As Long
yToName = sToUser & vbNullChar yFromName = sFromUser & vbNullChar yMsg = sMessage & vbNullChar If NetMessageBufferSend(ByVal 0&, yToName(0), yFromName(0), yMsg(0), UBound(yMsg)) = NERR_Success Then SendMsg = True End If End Function 具体发送实现部分地区; X = SendMsg(adress, SentFrom, TxtMsg.Text) 'adress是接收方地址,sentfrom是发送方地址,可以任意定义,txtmsg.text 是消息内容
另外,发送消息到域的话,可以用shell调用net send命令,该命令语法是: NET SEND {name | * | /DOMAIN[:name] | /USERS} message例如发送"hi"到"624"这个域: net send /domain:624 hi
shell "net send 工作组名 内容",vbhide
"net send ip 内容" 可以发送消息
编程实现使用
Private Declare Function NetMessageBufferSend Lib "NETAPI32.DLL" (Server As Any, yToName As Byte, yFromName As Any, yMsg As Byte, ByVal lSize As Long) As Long
Dim yToName() As Byte
Dim yFromName() As Byte
Dim yMsg() As Byte
Dim l As Long
yToName = sToUser & vbNullChar
yFromName = sFromUser & vbNullChar
yMsg = sMessage & vbNullChar If NetMessageBufferSend(ByVal 0&, yToName(0), yFromName(0), yMsg(0), UBound(yMsg)) = NERR_Success Then
SendMsg = True
End If
End Function
具体发送实现部分地区;
X = SendMsg(adress, SentFrom, TxtMsg.Text) 'adress是接收方地址,sentfrom是发送方地址,可以任意定义,txtmsg.text 是消息内容
NET SEND {name | * | /DOMAIN[:name] | /USERS} message例如发送"hi"到"624"这个域:
net send /domain:624 hi
用ping来判断..,至于如何ping一台机器,参考
http://expert.csdn.net/Expert/topic/2486/2486797.xml?temp=2.550906E-02
难道对于Win98就没有办法了吗?