Desktop Functions:

   Smart Device Functions:

Show Recent Changes
Subscribe (RSS)
Misc. Pages
Helpful Tools
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy
RasGetEntryDialParams (rasapi32)
The RasGetEntryDialParams function retrieves the connection information saved by the last successful call to the RasDial or RasSetEntryDialParams function for a specified phone-book entry.

C# Signature:

[DllImport("rasapi32.dll", SetLastError=true)]
static extern uint RasGetEntryDialParams(
   string lpszPhonebook,
   [In, Out] ref RASDIALPARAMS lprasdialparams,
   out bool lpfPassword);

VB Signature:

    <DllImport("rasapi32.dll", CharSet:=CharSet.Auto)> _
    Public Function RasGetEntryDialParams( _
    ByVal lpszPhonebook As String, _
    <[In](), Out()> ByRef lprasdialparams As RASDIALPARAMS, _
    <Out()> ByRef lpfPassword As Boolean) As Integer
    End Function


Declare Function RasGetEntryDialParams Lib "rasapi32.dll" (TODO) As TODO

User-Defined Types:




Tips & Tricks:

Please add some!

Sample Code:

    // Only this sample works on my Windows 7 + dotNET4
    [DllImport("rasapi32.dll", SetLastError = true)]
    public static extern uint RasGetEntryDialParamsW(
        string lpszPhonebook,
        IntPtr lprasdialparams,
        out bool lpfPassword);

    public RASDIALPARAMS GetDialParams() {
    var lpRasDialParams = new RASDIALPARAMS
         szEntryName = "Some dial name"

    // Initialize unmanged memory to hold the struct.
    IntPtr pnt = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(RASDIALPARAMS)));

    // Copy the struct to unmanaged memory.
    Marshal.StructureToPtr(lpRasDialParams, pnt, true);

    bool lprPassword = false;

    var nRet = RasGetEntryDialParamsW(null, pnt, out lprPassword);
    if (nRet != 0)
        // Clear unmanaged memory
        throw new Exception("Error text");

    // Copy unmanaged memory to the struct.
    lpRasDialParams = (RASDIALPARAMS)Marshal.PtrToStructure(pnt, typeof(RASDIALPARAMS));

    // Clear unmanaged memory

    return lpRasDialParams;

Alternative Managed API:


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" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

Access directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version