Private Declare Auto Function RasDial Lib "rasapi32.dll" (ByVal _
lpRasDialExtensions As IntPtr, ByVal lpszPhonebook As String, ByRef _
lpRasDialParams As RASDIALPARAMS, ByVal dwNotifierType As Integer, _
ByVal lpvNotifier As myrasdialfunc, ByRef lphRasConn As IntPtr) As _
Integer
User-Defined Types:
[StructLayout(LayoutKind.Sequential)]
internal class RASDIALEXTENSIONS
{
public readonly int dwSize = Marshal.SizeOf(typeof(RASDIALEXTENSIONS));
public uint dwfOptions = 0;
public int hwndParent = 0;
public int reserved = 0;
public int reserved1 = 0;
public RASEAPINFO RasEapInfo = new RASEAPINFO();
}
[StructLayout(LayoutKind.Sequential,CharSet = CharSet.Auto)]
internal class RASDIALPARAMS
{
public int dwSize = Marshal.SizeOf(typeof(RASDIALPARAMS));
[MarshalAs(UnmanagedType.ByValTStr,SizeConst =
(int) RasFieldSizeConstants.RAS_MaxEntryName+1)]
public string szEntryName = null;
[MarshalAs(UnmanagedType.ByValTStr,SizeConst =
(int) RasFieldSizeConstants.RAS_MaxPhoneNumber+1)]
public string szPhoneNumber = null;
[MarshalAs(UnmanagedType.ByValTStr,SizeConst =
(int) RasFieldSizeConstants.RAS_MaxCallbackNumber+1)]
public string szCallbackNumber = null;
[MarshalAs(UnmanagedType.ByValTStr,SizeConst =
(int) RasFieldSizeConstants.UNLEN+1)]
public string szUserName = null;
[MarshalAs(UnmanagedType.ByValTStr,SizeConst =
(int) RasFieldSizeConstants.PWLEN+1)]
public string szPassword = null;
[MarshalAs(UnmanagedType.ByValTStr,SizeConst =
(int) RasFieldSizeConstants.DNLEN+1)]
public string szDomain = null;
public int dwSubEntry = 0;
public int dwCallbackId = 0;
}
Notes:
Tips & Tricks:
Sample Code:
Alternative Managed API:
Nothing
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.
5/10/2010 8:00:51 AM - -93.180.241.4
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.
5/10/2010 8:00:51 AM - -93.180.241.4
ByVal is a VB keyword that specifies a variable to be passed as a parameter BY VALUE. In other words, if the function or sub changes the value of the internal variable, it does not change the value of the external variable that was passed to it.
4/25/2007 3:19:55 AM - josep1er@cmich.edu-141.209.229.179
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
ByVal is a VB keyword that specifies a variable to be passed as a parameter BY VALUE. In other words, if the function or sub changes the value of the internal variable, it does not change the value of the external variable that was passed to it.
4/25/2007 3:19:55 AM - josep1er@cmich.edu-141.209.229.179
ByRef is a VB keyword that specifies a variable to be passed as a parameter BY REFERENCE. In other words, the pointer to the variable is passed and any change to its value made within the function or sub will change its value outside the function/sub.
4/25/2007 3:19:29 AM - anonymous
ByVal is a VB keyword that specifies a variable to be passed as a parameter BY VALUE. In other words, if the function or sub changes the value of the internal variable, it does not change the value of the external variable that was passed to it.
4/25/2007 3:19:55 AM - josep1er@cmich.edu-141.209.229.179
ByVal is a VB keyword that specifies a variable to be passed as a parameter BY VALUE. In other words, if the function or sub changes the value of the internal variable, it does not change the value of the external variable that was passed to it.
4/25/2007 3:19:55 AM - josep1er@cmich.edu-141.209.229.179
ByRef is a VB keyword that specifies a variable to be passed as a parameter BY REFERENCE. In other words, the pointer to the variable is passed and any change to its value made within the function or sub will change its value outside the function/sub.
4/25/2007 3:19:29 AM - anonymous
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.