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
Solved

net send

Posted on 2004-09-02
4
616 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 Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

860 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