[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

net send

Posted on 2004-09-02
4
Medium Priority
?
620 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
[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
  • 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

Technology Partners: 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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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 this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

656 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