Solved

Net send syntax

Posted on 2001-07-02
4
416 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 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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to debug this code 7 61
Advice in Xamarin 21 79
Set email body to html using vbscript 6 41
RUNRMTCMD from AS/400 12 47
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

777 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