RasDial (rasapi32)
Last changed: -93.180.241.4

.
Summary
The RasDialDlg function establishes a RAS connection using a specified phone-book entry and the credentials of the logged-on user. The function displays a stream of dialog boxes that indicate the state of the connection operation.

C# Signature:

[DllImport("Rasdlg.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern bool RasDialDlg(
    IntPtr phoneBook,
    string entryName,
    IntPtr phoneNumber,
    ref RASDIALDLG info);

VB Signature:

TODO

User-Defined Types:

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;
}

Notes:

I don't use phoneBook and phoneNumber, so they are as IntPtr.

Sample Code:

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);

Alternative Managed API:

http://www.codeplex.com/DotRas - The RasDialDialog component in the project exposes functionality provided by the RasDialDlg API.

Documentation
RasDialDlg on MSDN