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 CurList As Long
Dim SendOver As Boolean
Private 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
On Error Resume Next
If Trim(TxtMsg.Text) = "" Then Exit Function
yToName = sToUser & vbNullChar
yFromName = sFromUser & vbNullChar
yMsg = sMessage & vbNullChar
If NetMessageBufferSend(ByVal 0&, yToName(0), ByVal 0&, yMsg(0), UBound(yMsg)) = NERR_Success Then
SendMsg = True
If Timer1.Enabled = False Then '如果不是骚扰状态下,记录信息/清空发送的内容
List1.AddItem TxtMsg.Text, 0
TxtMsg.Text = ""
CurList = -1 '当前指针指向第一条之后
SendOver = True
End If
End If
End Function