NET SEND application front end. How?

Hello experts,

There is a command line program in windows 2000 called NetSend that allows you to send messages to users loggeg in to a certain domain name. I was thinking of building a simple interface to send these messages instead of the command prompt window. How would I do that?

Controls

Form1 - The form
Textbox1 - "To a single user" box
Textbox2 - Body of the message
Button1 - Send it!

Sample Sintax:
C:\net send who what
C:\net send johndoe Hello there!

Thanks for anything!
LVL 1
donniedarko801Asked:
Who is Participating?
 
Bob LearnedConnect With a Mentor Commented:
This is the class that I use:

Public Class NetSend

  ''' -----------------------------------------------------------------------------
  ''' <summary>
  ''' Send a message to a user or a domain
  ''' </summary>
  ''' <remarks>
  '''    The syntax of this command is:
  '''     NET SEND
  ''' {name | * | /DOMAIN[:name] | /USERS} message
  ''' </remarks>
  ''' <history>
  '''   [Bob]  6/7/2006  Created
  ''' </history>
  ''' -----------------------------------------------------------------------------
  Public Shared Sub SendMessage(ByVal name As String, ByVal domain As String, ByVal message As String)

    Dim process As New Process

    Dim arguments As String = "SEND"

    If domain.Length > 0 Then
      arguments &= " /DOMAIN:" & domain
    End If

    process.StartInfo.FileName = "net.exe"
    process.StartInfo.Arguments = arguments

    process.StartInfo.CreateNoWindow = True
    process.StartInfo.ErrorDialog = False
    process.StartInfo.RedirectStandardOutput = False
    process.StartInfo.RedirectStandardInput = False
    process.StartInfo.RedirectStandardError = False
    process.StartInfo.UseShellExecute = False

    process.Start()

    process.WaitForExit(2000)

  End Sub

End Class

Example:
  NetSend("JohnDoe", "", "Hello there!!!")

Bob
0
 
donniedarko801Author Commented:
Thanks! You've already got my points. I'll reaised points reward to 350 for one last question.

I'm looking for a way to spoof who the message is coming from and I was wondering how to implement it in the code above.

I think this post talks about it but I like how clean your code is, :-)

Here's what it's about: NetMessageBufferSend
Here's the usage I think... NetMessageBufferSend( hosttosendto, mesgname, myspoofedname, message, messagelen );
Here's the post I've found: http://www.experts-exchange.com/Operating_Systems/WinNT/Q_20125951.html

Thanks again!
0
 
Bob LearnedCommented:
Never worked with NetMessageBufferSend.  What is the legitimate reason for wanting to spoof?

Bob
0
 
donniedarko801Author Commented:
Reason is message could be sent by more then one person on the same department but is not that big of a deal. Thanks anyway :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.