calahanpat
asked on
Net send syntax
I am making a simple netsend interface.
I have made a project with two text boxes and a command button. The command button will do the following
shell "netsend workstation message"
what I need to know is how to make the following happen
text1.text=workstation
text2.text=message
how would the statement then go??
I have tried the following to no end
text1.text=workstation
text2.text=message
shell "netsend " ' workstation '";" ' message '""
what is the right way to do it??
I have made a project with two text boxes and a command button. The command button will do the following
shell "netsend workstation message"
what I need to know is how to make the following happen
text1.text=workstation
text2.text=message
how would the statement then go??
I have tried the following to no end
text1.text=workstation
text2.text=message
shell "netsend " ' workstation '";" ' message '""
what is the right way to do it??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This is how to call the above function.
Dim blnMessageSent As Boolean
Dim strMessage As String
Dim strDestination As String
strMessage = "Hello"
strDestination = "Your_Dest_Comp"
blnMessageSent = BroadcastMessage(strDestin ation, Trim$(strMessage), String$(Len(Trim$(strMessa ge)), Space$(1)))
If Not blnMessageSent Then
MsgBox "Message Not Sent"
End If
hongjun
Dim blnMessageSent As Boolean
Dim strMessage As String
Dim strDestination As String
strMessage = "Hello"
strDestination = "Your_Dest_Comp"
blnMessageSent = BroadcastMessage(strDestin
If Not blnMessageSent Then
MsgBox "Message Not Sent"
End If
hongjun
ASKER
Thanks! Exactly what I was looking for!Simple and to the point!
Option Explicit
Public Declare Function NetMessageBufferSend Lib "NETAPI32.DLL" _
(yServer As Any, yToName As Byte, yFromName As Any, yMsg As Byte, _
ByVal lSize As Long) As Long
Public Const NERR_Success As Long = 0&
Public gstrMessage() As String
Public gstrTime() As String
'Public AddressBk_Type As Integer ' 1:Add to sender 2: Edit 3: Delete
Public Function BroadcastMessage(UserOrMac
FromNames 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 = FromNames & vbNullChar
MessageToSend = Message & vbNullChar
'Broadcast message via API
If NetMessageBufferSend(ByVal
FromName(0), UBound(MessageToSend)) = NERR_Success Then
'Return True if it worked
BroadcastMessage = True
End If
End Function