Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


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

RasGetEntryDialParams (rasapi32)
 
.
Summary
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

.or.

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

User-Defined Types:

RASDIALPARAMS

Notes:

None.

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

Please add some!

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

Alternative Managed API:

http://www.codeplex.com/DotRas

    // 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
        Marshal.FreeHGlobal(pnt);
        throw new Exception("Error text");
    }

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

    // Clear unmanaged memory
    Marshal.FreeHGlobal(pnt);

    return lpRasDialParams;
    }

Alternative Managed API:

http://www.codeplex.com/DotRas

Documentation

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 PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions