?
Solved

net send

Posted on 2004-09-02
4
Medium Priority
?
621 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 23

Accepted Solution

by:
Ferruccio Accalai earned 500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Loops Section Overview
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

850 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