Solved

Net send syntax

Posted on 2001-07-02
4
414 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
Comment Utility
shell "netsend " & text1.text & " " & text2.text
0
 
LVL 33

Expert Comment

by:hongjun
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks! Exactly what I was looking for!Simple and to the point!
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now