不能隐藏,如果你用API函数发送就可隐藏了,给你一段代码:
Private Declare Function NetMessageBufferSend Lib "NETAPI32.DLL" _
(yServer As Any, yToName As Byte, yFromName As Any, yMsg As Byte, _
ByVal lSize As Long) As Long
Private Const NERR_Success As Long = 0&
Public Function BroadcastMessage(UserOrMachine As String, fFromName As String, Message As String) As Boolean
Dim ToName() As Byte
Dim FromName() As Byte
Dim MessageToSend() As Byte
' Put data into byte arrays
ToName = UserOrMachine & vbNullChar
FromName = fFromName & vbNullChar
MessageToSend = Message & vbNullChar
' Broadcast message via API
If NetMessageBufferSend(ByVal 0&, ToName(0), FromName(0), _
MessageToSend(0), UBound(MessageToSend)) = NERR_Success Then
' Return True if it worked
BroadcastMessage = True
End If
End Function
Private Sub Command1_Click()
BroadcastMessage "sha-kennyhao-01", vbNullString, "Hello"
End Sub================================================================
共同学习,共同进步
Private Declare Function NetMessageBufferSend Lib "NETAPI32.DLL" _
(yServer As Any, yToName As Byte, yFromName As Any, yMsg As Byte, _
ByVal lSize As Long) As Long
Private Const NERR_Success As Long = 0&
Public Function BroadcastMessage(UserOrMachine As String, fFromName As String, Message As String) As Boolean
Dim ToName() As Byte
Dim FromName() As Byte
Dim MessageToSend() As Byte
' Put data into byte arrays
ToName = UserOrMachine & vbNullChar
FromName = fFromName & vbNullChar
MessageToSend = Message & vbNullChar
' Broadcast message via API
If NetMessageBufferSend(ByVal 0&, ToName(0), FromName(0), _
MessageToSend(0), UBound(MessageToSend)) = NERR_Success Then
' Return True if it worked
BroadcastMessage = True
End If
End Function
Private Sub Command1_Click()
BroadcastMessage "sha-kennyhao-01", vbNullString, "Hello"
End Sub================================================================
共同学习,共同进步
Private Declare Function NetMessageBufferSend Lib "NETAPI32.DLL" (Server As Any, yToName As Byte, yFromName As Any, yMsg As Byte, ByVal lSize As Long) As LongPublic Function Sendmsg(strTo As String, strFrom As String, strMessage As String) As Boolean
' #define UNICODE
' #define MESGLEN 50
' WCHAR awcToName[] = TEXT("DomainName*");
' WCHAR awcFromName[] = Text("MyComputer");
' WCHAR awcMesgBuffer[MESGLEN] = Text("This ia Test Message");
' NET_API_STATUS nasStatus;
'
' nasStatus = NetMessageBufferSend(NULL,
' awcToName,
' awcFromName,
' awcMesgBuffer,
' MESGLEN);
Dim bytTo() As Byte
Dim bytFrom() As Byte
Dim bytMsg() As Byte
Dim bytName
bytTo = strTo & vbNullChar
bytName = strFrom & vbNullChar
bytMsg = strMessage & vbNullChar
bytFrom = strFrom & vbNullChar
'Sendmsg = (NetMessageBufferSend(ByVal 0&, yToName(0), ByVal 0&, yMsg(0), UBound(yMsg)) = NERR_Success)
Sendmsg = (NetMessageBufferSend(ByVal 0&, bytTo(0), bytFrom(0), bytMsg(0), UBound(bytMsg)) = NERR_Success)
End FunctionPrivate Sub cmdsend_Click()
Sendmsg Txttgt.Text, Txtself.Text & "在" & Winsock1.LocalIP & "上", Richmsg.Text
End SubPrivate Sub Command1_Click()
Dim inti
For inti = 1 To Txtself.Text
Sendmsg Txttgt.Text, Txtself.Text & "在" & Winsock1.LocalIP & "上", Richmsg.Text
Next inti
End Sub