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 RasDial function establishes a RAS connection between a RAS client and a RAS server. The connection data includes callback and user-authentication information.
08/01/2008 10:09:02 - Patrick-217.128.127.11
The RasDial function establishes a RAS connection between a RAS client and a RAS server. The connection data includes callback and user-authentication information.
08/01/2008 10:09:02 - Patrick-217.128.127.11
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.
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.
13/01/2008 11:00:13 - tsahi-62.219.227.88
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.
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.
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.
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.
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.
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.
13/01/2008 11:00:13 - tsahi-62.219.227.88
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" in the upper right corner and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).
Profile your .NET code
Boost the performance of your application with ANTS Profiler
This download also contains the FREE PInvoke.net Visual Studio Add-in