?
Solved

Using "Net send command"

Posted on 2003-03-07
10
Medium Priority
?
2,413 Views
Last Modified: 2007-12-19
halo there,.....

currently i've been using the winXp "Net Send" command to send the message to other Pc over the local network.
i have incorporate the dos-command into my program. but i discover that there seem no way to let my program get the feedback from the command whether the message have successfully send to the destination.
is there anyway to let the program know that the message have successfully sent or not...

my program looks like this


shell(net send ksboyz halo )

i am using the shell function to run the command line....

from
ksboyz
0
Comment
Question by:ksboyz
[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
  • 3
  • 3
  • 2
  • +2
10 Comments
 
LVL 33

Assisted Solution

by:hongjun
hongjun earned 200 total points
ID: 8093110
0
 
LVL 1

Expert Comment

by:J-Man
ID: 8095365
If all you want is to know if the message was sent successfully you could change your code to:

shell(net send ksboyz halo > C:\feedback.txt)

Then open and read the C:\feedback.txt file into a string.  It will look like either:
(1) The message was successfully sent to ksboyz.
or
(2) An error occurred while sending a message to ksboyz.

Then check the string for either "successfully" or "error" and you'll know if it worked or not.

Note: A failure to send may take a while to register depending on the timeout value (could be 60 - 90 seconds or more), so you will either have to wait a specified amount of time before checking the feedback.txt file or monitor your shell command to know when it terminates.
0
 

Author Comment

by:ksboyz
ID: 8098285
halo..... J-man ....i've tried to run it but it seem doesn't work....though if it's in command-dos prompt mode, by simple typing out the statement...it works...

but unfortunately, i try to write it on the program but it shown all the statement(including >c:\feedback.txt) instead of saving feedback to feedback.txt

i=Shell("net send ksboyz haha > C:\feedback.txt", vbHide)
: (


from
ksboyz
0
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!

 
LVL 1

Accepted Solution

by:
J-Man earned 200 total points
ID: 8099345
Oh yeah, I forgot about that "feature".  ;-)
We should use a batch file instead...  try this:

1) Create a text file called "mysend.bat" (without quotes) in the c:\ folder.  You may want to do this (and step 2) with your program if you intend to distribute it, or install the bat file with your setup program.

2) In the mysend.bat file type in the following text and save the file:

net send %* > c:\feedback.txt

3) Change the VB code to:

Dim myStr as String
myStr = "c:\mysend.bat" & " " & "Computername" & " " & "The message text"
'for your example, you would put in "ksboyz" for "computername", and "halo" for "the message text"
i=Shell(mystr, vbhide)
'wait a few seconds
'check c:\feedback.txt file
0
 

Expert Comment

by:CleanupPing
ID: 8900478
ksboyz:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
LVL 33

Expert Comment

by:hongjun
ID: 8903854
split b/w J-Man(Accepted) and hongjun
0
 
LVL 1

Expert Comment

by:J-Man
ID: 8903961
I agree with hongjun.
Split the points.
0
 

Expert Comment

by:CleanupPing
ID: 9056497
ksboyz:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 33

Expert Comment

by:hongjun
ID: 9056829
split b/w J-Man(Accepted) and hongjun
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 9074451
Moderator, my recommended disposition is:

    Split points between: hongjun and J-Man

DanRollins -- EE database cleanup volunteer
0

Featured Post

Industry Leaders: 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

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…
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 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…
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…
Suggested Courses
Course of the Month8 days, 17 hours left to enroll

765 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