我想在一台机器上通过局域网发一条消息给其它在线的机器,该用什么函数?怎么写?
另外,怎么判断一台机器是否在线?

解决方案 »

  1.   

    2000以上版本
    shell "net send 工作组名 内容",vbhide
      

  2.   

    我机器是win2000的,但要接受信息的机器有98、NT4.0、2000和XP,请问我该怎么写啊?
      

  3.   

    "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
      

  4.   

    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 是消息内容
      

  5.   

    另外,发送消息到域的话,可以用shell调用net send命令,该命令语法是:
    NET SEND {name | * | /DOMAIN[:name] | /USERS} message例如发送"hi"到"624"这个域:
    net send /domain:624 hi
      

  6.   

    另外,怎么判断一台机器是否在线?
    用ping来判断..,至于如何ping一台机器,参考
    http://expert.csdn.net/Expert/topic/2486/2486797.xml?temp=2.550906E-02
      

  7.   

    这多麻烦啊
    难道对于Win98就没有办法了吗?