Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Net send syntax

Posted on 2001-07-02
4
Medium Priority
?
424 Views
Last Modified: 2007-12-19
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??
0
Comment
Question by:calahanpat
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
DRRYAN3 earned 200 total points
ID: 6246834
shell "netsend " & text1.text & " " & text2.text
0
 
LVL 33

Expert Comment

by:hongjun
ID: 6246889
Try this and place them in a module. Pass in

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(UserOrMachine As String, _
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 0&, ToName(0), ByVal 0&, _
    FromName(0), UBound(MessageToSend)) = NERR_Success Then
        'Return True if it worked
        BroadcastMessage = True
    End If

End Function
0
 
LVL 33

Expert Comment

by:hongjun
ID: 6247056
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(strDestination, Trim$(strMessage), String$(Len(Trim$(strMessage)), Space$(1)))
If Not blnMessageSent Then
     MsgBox "Message Not Sent"
End If

hongjun
0
 

Author Comment

by:calahanpat
ID: 6247073
Thanks! Exactly what I was looking for!Simple and to the point!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question