RasEnumConnections
C# Signature:
[DllImport("rasapi32.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern int RasEnumConnections(
[In, Out] RASCONN[] rasconn,
[In, Out] ref int cb,
[Out] out int connections);VB Signature:
TODOUser-Defined Types:
const int RAS_MaxEntryName = 256;
const int RAS_MaxDeviceType = 16;
const int RAS_MaxDeviceName = 128;
const int MAX_PATH = 260;
const int ERROR_BUFFER_TOO_SMALL = 603;
const int ERROR_SUCCESS = 0;
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Auto)]
public struct RASCONN
{
public int dwSize;
public IntPtr hrasconn;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxEntryName)]
public string szEntryName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxDeviceType)]
public string szDeviceType;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxDeviceName)]
public string szDeviceName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_PATH)]
public string szPhonebook;
public int dwSubEntry;
public Guid guidEntry;
public int dwFlags;
public Guid luid;
}Sample Code:
An alternative sample (Windows Vista or later) based on http://msdn.microsoft.com/en-us/library/aa377284(VS.85).aspx
Última actualización