[DllImport("Rasdlg.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern bool RasDialDlg(
IntPtr phoneBook,
string entryName,
IntPtr phoneNumber,
ref RASDIALDLG info);
TODO
public const int ERROR_SUCCESS = 0;
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Auto)]
public struct RASDIALDLG
{
public int dwSize;
public IntPtr hwndOwner;
public int dwFlags;
public int xDlg;
public int yDlg;
public int dwSubEntry;
public int dwError;
public IntPtr reserved;
public IntPtr reserved2;
}
I don't use phoneBook and phoneNumber, so they are as IntPtr.
RASDIALDLG info = new RASDIALDLG();
info.dwSize = Marshal.SizeOf(info);
bool ret = RAW.RasDialDlg(IntPtr.Zero, "Some Connection Name", IntPtr.Zero, ref info);
if (ret == false && info.dwError != ERROR_SUCCESS)
throw new Win32Exception(info.dwError);
http://www.codeplex.com/DotRas