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

Managed API for "NET SEND"

13 views
Skip to first unread message

Morten Teinum

unread,
Feb 10, 2004, 6:19:30 PM2/10/04
to
Hi Daniel.

Not sure about a managed version, but you can use interop ala this:

using System.Runtime.InteropServices;

public class NetMessage
{
public static void Test()
{
NetMessage.Send("morten", "morten", "message from user");
NetMessage.Send("morten", "message from machine");
}

public static void Send(string to, string message)
{
Send(to, null, message);
}

public static void Send(string to, string from, string message)
{
byte[] buf = System.Text.Encoding.Unicode.GetBytes(message);

int err = NetMessageBufferSend(null, to, from, buf, buf.Length);

if ( err != 0 )
throw new System.ComponentModel.Win32Exception( err );
}

[DllImport("Netapi32", CharSet=CharSet.Unicode)]
private static extern int NetMessageBufferSend(
string servername,
string msgname,
string fromname,
byte[] buf,
int buflen);
}

Morten

"Daniel" <anon...@discussions.microsoft.com> wrote in message
news:7281E163-FB33-4163...@microsoft.com...
> Is there a manaped API for the Windows messaging service a la Net Send?

0 new messages