Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than netapi32, prefix the name with the module name and a period.
NetMessageBufferSend (netapi32)
.
C# Signature:
[DllImport("netapi32.dll")]
static extern int NetMessageBufferSend(
[MarshalAs(UnmanagedType.LPWStr)] string servername,
[MarshalAs(UnmanagedType.LPWStr)] string msgname,
[MarshalAs(UnmanagedType.LPWStr)] string fromname,
[MarshalAs(UnmanagedType.LPWStr)] string buf,
int buflen);
VB Signature:
Declare Function NetMessageBufferSend Lib "netapi32.dll" (TODO) As TODO
using System;
using System.Runtime.InteropServices;
public class SendNetMsg
{
const int NERR_Success = 0;
const int NERR_BASE = 2100;
const int NERR_NameNotFound = (NERR_BASE+173); // The message alias could not be found on the network.
const int NERR_NetworkError = (NERR_BASE+36); // A general network error occurred.
const int ERROR_ACCESS_DENIED = 5;
const int ERROR_INVALID_PARAMETER = 87;
const int ERROR_NOT_SUPPORTED = 50;
[DllImport("netapi32.dll")]
public static extern int NetMessageBufferSend(
[MarshalAs(UnmanagedType.LPWStr)] string servername,
[MarshalAs(UnmanagedType.LPWStr)] string msgname,
[MarshalAs(UnmanagedType.LPWStr)] string fromname,
[MarshalAs(UnmanagedType.LPWStr)] string buf,
int buflen);
public static void Main (String[] argv)
{
if (argv.Length < 3)
{
Console.WriteLine ("sendnetmsg.exe srcName dstName msg");
return;
}
if (retVal == NERR_NameNotFound)
Console.WriteLine ("Error: NERR_NameNotFound") ;
else if (retVal == NERR_NetworkError)
Console.WriteLine ("Error: NERR_NetworkError") ;
else if (retVal == ERROR_ACCESS_DENIED)
Console.WriteLine ("Error: ERROR_ACCESS_DENIED") ;
else if (retVal == ERROR_INVALID_PARAMETER)
Console.WriteLine ("Error: ERROR_INVALID_PARAMETER") ;
else if (retVal == ERROR_NOT_SUPPORTED)
Console.WriteLine ("Error: ERROR_NOT_SUPPORTED") ;
else if (retVal != 0)
Console.WriteLine ("Unknown error returned.\nError code {0}", retVal) ;
}
}
Alternative Managed API:
Do you know one? Please contribute it!
This function sends a buffer of information to a registered message alias.
3/16/2007 8:05:08 AM - -84.161.130.31
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).