Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Implementing NET SEND command in my application

Status
Not open for further replies.

Delphard

Programmer
Jul 22, 2004
144
RS
Is it possible to run NET SEND command from Windows application?
Actually, command is NET, with syntax:
NET SEND [host_adress|*] 'some_message'
How to forward these Parameters to NET command?
 
Have you looked at the FAQs ?

faq102-5462 should be relevant.

Andrew
Hampshire, UK
 
Yes, but using:
ShellExecute(0, 'Open', PChar('c:\Windows\system32\net.exe'), PChar('send 192.168.1.1 messagetext'), PChar(''), SW_Hide);
doesn't produce any effect from my app, and even generates error when run from Delphi!?
I'm not sure is it possible to use ShellExecute for programs that should be run from Command prompt...
 
It is quite simple to use WinExec:

WinExec(PChar('NET SEND whatever'), 0);

Change the 0 to a 1 to hide the console box that flashes up for a moment. The cast to a PChar is in case you want to replace any part of the string with a variable, eg:

WinExec(PChar('NET SEND ' + address + ' ' + message), 0);
 
@KempCGDR:
Tnx, but... Did you try your suggestion? I try and it doesn't work, nothing happens!?!?
Just an 'command prompt like' windows appears for second, but message isn't send nor any error message appears.
 
Well, I have to admit that it was adapted from something else I was using, but that was also one of the NET commands, so I don't see why that should work and this not.

The appropriate service is running on your machine, correct?
 
NET SEND command works fine from Command Prompt.
But, I can't find mathod to run it from my application. I try both of your suggestions (ShellExecute and WinExec) without results. Any advice? Tnx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top