Solved

net send

Posted on 2004-09-02
4
613 Views
Last Modified: 2010-04-05
hi delphi friends

tricky question :)

few years ago i made in msword visual basic editor programm wich send message to net users using [net send] COMAND.

problem is - i can't remmber how.

i want to make this soft on delphi. i'm using XP OS. so we have to use command promp.exe to do this.

so in basic i did sommething like this (C:\comandpromp.exe)+netsend+user+message

so exsample:

user:=edit1.text
message:=edit2.text
HERE must be the line wich cals comandpromt and sends message

/////////////////////////

mybe somebody can help :)

i'm trying to make this soft so lets see who will make it first....

bye
0
Comment
Question by:Kristao
  • 2
4 Comments
 
LVL 17

Expert Comment

by:geobul
ID: 11962448
Hi,

Why to open a command prompt session when there is an API function for doing this:

procedure NetSendMessage(const ToComputer, FromComputer, Mess: string);
type
  TNetMessageBufferSendFunction = function(servername, msgname, fromname: PWideChar; buf: PWideChar; buflen: Cardinal): longint; stdcall;
var
  NetMessageBufferSend: TNetMessageBufferSendFunction;
  DLLHandle: THandle;
  Name, From, Buf: WideString;
begin
  DLLHandle := LoadLibrary('NETAPI32.DLL');
  if DLLHandle <> 0 then begin
    try
      @NetMessageBufferSend := GetProcAddress(DLLHandle, 'NetMessageBufferSend');
      if @NetMessageBufferSend <> nil then begin
        Name := ToComputer;
        Buf := Mess;
        From := FromComputer; // you may even set
        NetMessageBufferSend(nil, PWideChar(Name), PWideChar(From), PWideChar(Buf), Length(Buf) * SizeOf(WideChar));
      end;
    finally
      FreeLibrary(DLLHandle);
    end;
  end;
end;

Regards, Geo
0
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 125 total points
ID: 11962464
uses SHellApi
var
user,message : string;
begin
user:=edit1.text
message:=edit2.text
shellexecute(0,'open','net',pchar('send' +' '+user+ ' ' + message),nil,SW_HIDE);
end;
0
 

Expert Comment

by:lehongwang
ID: 12206469
geobul  has got the best answer !
0
 
LVL 17

Expert Comment

by:geobul
ID: 12215109
Thank you lehongwang :-)
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

746 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

13 Experts available now in Live!

Get 1:1 Help Now