Net send in delphi

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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

As far as I remember it can be done with using of mailslot.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
oops forgot to tell dont forget to put shellapi in the uses
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

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);
ionetAuthor Commented:
care to do some explaining instead of just code?

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

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.