同题

解决方案 »

  1.   

    利用NetMessageBufferSend函数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) '通过修改SentFrom的值可以改变发送方的机器名