Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using Net Send from my application

4 views
Skip to first unread message

stever

unread,
Dec 5, 2002, 7:17:59 PM12/5/02
to
Let's say that I wanted to use the windows net send service in my
application... is that easy? I'm a newbie... I started looking into
Shell32.dll to execute a command, but I think I was barking up the wrong
tree.... where should I be looking to get this going?

TIA-


Felix Wu(MS)

unread,
Dec 8, 2002, 10:01:56 PM12/8/02
to
Hi Stever,

You can use the NetMessageBufferSend API via PInvoke to implement Net Send
command for your application. You can try this:

[DllImport("netapi32.dll", CharSet=CharSet.Unicode)]
public static extern int NetMessageBufferSend( string serverName, string
msgName, string fromName, string buf, int bufLen)

enum NET_API_STATUS
{
NERR_Success = 0,
ERROR_ACCESS_DENIED = 5,
ERROR_INVALID_PARAMETER = 87,
ERROR_NOT_SUPPORTED = 50,
NERR_NetworkError = 2136,
NERR_NameNotFound = 2273
//
// For a complete list, please check lmerr.h
//
}

Alternatively, you can use the "net send" command as the following example
application does:

Windows Messenger like GUI for net send command (By Sunil TG)
http://www.codeproject.com/csharp/dotnetsenders.asp

It writes the "net send ..." commands into a .BAT file, and then execute
the BAT file with the Process class.

Hope this helps.

Regards,

Felix Wu
=============
This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
>From: "stever" <sklett_20...@yahoo.com>
>Subject: Using Net Send from my application
>Date: Thu, 5 Dec 2002 16:17:59 -0800
>Lines: 8
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
>Message-ID: <e#c0z1LnCHA.2404@TK2MSFTNGP10>
>Newsgroups: microsoft.public.dotnet.languages.csharp
>NNTP-Posting-Host: bdsl.66.13.180.45.gte.net 66.13.180.45
>Path: cpmsftngxa06!tkmsftngp01!TK2MSFTNGP10
>Xref: cpmsftngxa06 microsoft.public.dotnet.languages.csharp:114228
>X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

Luis

unread,
Dec 17, 2002, 12:21:11 PM12/17/02
to
System.Diagnostics.Process.Start(Environment.GetEnvironmentVariable("COMSPEC"),
String.Format("/c net send {0} \"{1}\"", target, msg));
0 new messages