Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Net send in delphi

Posted on 2003-11-21
Medium Priority
Last Modified: 2012-06-27
Hi experts,

I was wondering how I can use a net send in my program. Not a net send through DOS (shellexecute) but one actually using the net DLL. Thanks.
Question by:ionet
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

Accepted Solution

GloomyFriar earned 128 total points
ID: 9796456
As far as I remember it can be done with using of mailslot.

Assisted Solution

amjedmsa earned 124 total points
ID: 9797035
it seem you dont want to show your app user the dos screen thats simple and also i dont know any free compnent or comercial compnent to do this trik

check this code put it under a button e.g
procedure TForm1.Button1Click(Sender: TObject);

shellexecute(handle,'open',pchar('net'),pchar(' '+'send' +' '+ edit1.text + ' ' + edit2.text),nil,SW_HIDE)


and edit1 will be the host name or the ip number of the computer
edit2 will be the message

once u hit the button the message will apear instantly in his computer
and no one will see the command line screen
also this is better than a component this way save's space

Expert Comment

ID: 9797050
oops forgot to tell dont forget to put shellapi in the uses
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


Assisted Solution

cqhall earned 124 total points
ID: 9799166
Try This:

function NetSend(dest, source, msg: string): longint;
 TNetMessageBufferSendFunction = function(servername, msgname, fromname: PWideChar; buf:
 PWideChar; buflen: Cardinal): longint; stdcall;
 NetMessageBufferSend: TNetMessageBufferSendFunction;

 SourceWideChar  : PWideChar;
 DestWideChar   : PWideChar;
 MessagetextWideChar: PWideChar;

 Handle      : THandle;

 Handle := LoadLibrary('NETAPI32.DLL');
 if Handle = 0 then
 Result := GetLastError;
 @NetMessageBufferSend := GetProcAddress(Handle, 'NetMessageBufferSend');
 if @NetMessageBufferSend = nil then
 Result := GetLastError;
 MessagetextWideChar := nil;
 GetMem(MessagetextWideChar, Length(msg) * SizeOf(WideChar) + 1);
 GetMem(DestWideChar, 20 * SizeOf(WideChar) + 1);
 StringToWideChar(msg, MessagetextWideChar, Length(msg) * SizeOf(WideChar) + 1);
 StringToWideChar(Dest, DestWideChar, 20 * SizeOf(WideChar) + 1);
 if source = '' then
  result := NetMessageBufferSend(nil, DestWideChar, nil, MessagetextWideChar, Length(msg) * SizeOf(WideChar) + 1)
 end else
  GetMem(SourceWideChar, 20 * SizeOf(WideChar) + 1);
  StringToWideChar(source, SourceWideChar, 20 * SizeOf(WideChar) + 1);
  result := NetMessageBufferSend(nil, DestWideChar, SourceWideChar, MessagetextWideChar,
       Length(msg) * SizeOf(WideChar) + 1);

Author Comment

ID: 9802831
care to do some explaining instead of just code?

Assisted Solution

Delphian earned 124 total points
ID: 10173431

cqhall - (S)/He uses the API contained on NETAPI.dll on what
the NET SEND is based. It calls the DLL, gets the function
and configure the parameters to finally execute the send.
After it, it unloads the DLL and free all memory.

amjedmsa - S/He uses the shell ShellExecute function available
on shellapi.pas unit on Delphi. It runs the NET.exe executable
like you would make it manually.

If  you accept this answer, please split the points....

[]s Fabricio


Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
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…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

715 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