Solved

Net send syntax

Posted on 2001-07-02
4
418 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
DRRYAN3 earned 50 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Validating VB6 Function 19 68
MsgBox 2 61
How to read File Date Created using VB6 8 62
backup program with robocopy 6 73
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

749 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