?
Solved

net send

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

801 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