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 coredll, prefix the name with the module name and a period.
RasEnumConnections (coredll)
coredll is for smart devices, not desktop Windows. Therefore, this information only applies to code using the .NET Compact Framework. To see if information for RasEnumConnections in other DLLs exists, click on Find References to the right.
.
C# Signature:
[DllImport("coredll.dll", CharSet = CharSet.Unicode)]
internal static extern UInt32 RasEnumConnections([In, Out] _RASCONN[] lprasconn, ref UInt32 lpcb, ref UInt32 lpcConnections);
User-Defined Types:
const int RAS_MaxEntryName = 20;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
internal struct _RASCONN
{
private UInt32 m_size;
private IntPtr m_hrasconn;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = RAS_MaxEntryName + 1)]
private char[] m_entryName;
public IntPtr ConnectionHandle { get { return m_hrasconn; } }
public string EntryName { get { return new string(m_entryName).TrimEnd(new char[] { '\0' }); } }
public static _RASCONN CreateStruct()
{
_RASCONN obj = new _RASCONN();
obj.m_size = System.Convert.ToUInt32(Marshal.SizeOf(typeof(_RASCONN)));
obj.m_hrasconn = IntPtr.Zero;
obj.m_entryName = new char[RAS_MaxEntryName + 1];
return obj;
}
}
Sample Code:
public static _RASCONN[] EnumerateConnections()
{
_RASCONN[] rasconn;
UInt32 size = 0, noelements = 0;
size = System.Convert.ToUInt32(Marshal.SizeOf((rasconn = new _RASCONN[1])[0] = _RASCONN.CreateStruct()));
if (RasEnumConnections(rasconn, ref size, ref noelements) != 0x00)
{
size = System.Convert.ToUInt32(Marshal.SizeOf((rasconn = new _RASCONN[size / Marshal.SizeOf(typeof(_RASCONN))])[0] = _RASCONN.CreateStruct()) * rasconn.Length);
if (RasEnumConnections(rasconn, ref size, ref noelements) != 0x00) { rasconn = null; }
}
return rasconn;
}
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).