Results 1 to 3 of 3

Thread: How to implement an API....someone?

  1. #1
    Guest

    Question

    Im trying to use this:
    Public Declare Function RasEnumConnections Lib "rasapi32.dll" Alias "RasEnumConnectionsA" ( ByRef lprasconna As RASCONN, ByRef lpdword As Long, ByRef lpdword As Long) As Long

    Ive read the tutorials, but they dont quite fit the way this one works...or do they? Im stuck, well and truely.

    What Im trying to do is to get the current RAS Connection into a textbox, just what each of the different paramaters means in this wonderfull little API is a mystery to me...can anyone shed any light on the situation???

    I would appreciate any help and am offering $10000000 to the first to help me (Im joking...in case you thought I meant that)

  2. #2
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    RasEnumConnections (long post)

    Here's a few excerpts form the SDK documentation. I don't have a URL for it I'm sorry, but I am sure you can get the same SDK info directly form some Microsoft site.

    It's probably not what you need but unless someone else who has already done this replies to you with the declares, you might have to do it the hard way...



    Remote Access Service Structures
    Use the following structures to implement Remote Access Service functionality.

    RASADPARAMS
    RASAMB
    RASAUTODIALENTRY
    RASCONN
    RASCONNSTATUS
    RASCREDENTIALS
    RASCTRYINFO
    RASDEVINFO
    RASDIALDLG
    RASDIALEXTENSIONS
    RASDIALPARAMS
    RASENTRY
    RASENTRYDLG
    RASENTRYNAME
    RASIPADDR
    RASMONITORDLG
    RASNOUSER
    RASPBDLG
    RASPPPIP
    RASPPPIPX
    RASPPPNBF
    RASSLIP
    RASSUBENTRY

    --------------------


    RasEnumConnections
    The RasEnumConnections function lists all active RAS connections. It returns each connection's handle and phone-book entry name.

    DWORD RasEnumConnections(
    LPRASCONN lprasconn, // buffer to receive connections data
    LPDWORD lpcb, // size in bytes of buffer
    LPDWORD lpcConnections
    // number of connections written to buffer
    );

    Parameters
    lprasconn
    Points to a buffer that receives an array of RASCONN structures, one for each RAS connection. Before calling the function, an application must set the dwSize member of the first RASCONN structure in the buffer to sizeof(RASCONN) in order to identify the version of the structure being passed.
    lpcb
    Points to a variable that contains the size, in bytes, of the buffer specified by lprasconn. On return, the function sets this variable to the number of bytes required to enumerate the RAS connections.
    lpcConnections
    Points to a variable that the function sets to the number of RASCONN structures written to the buffer specified by lprasconn.
    Return Values
    If the function succeeds, the return value is zero.

    If the function fails, the return value is either a nonzero error value listed in the RAS header file or ERROR_BUFFER_TOO_SMALL or ERROR_NOT_ENOUGH_MEMORY.

    -------------------------------
    RASCONN
    [This is preliminary documentation and subject to change.]

    The RASCONN structure provides information about a remote access connection. The RasEnumConnections function returns an array of RASCONN structures.

    typedef struct _RASCONN {
    DWORD dwSize;
    HRASCONN hrasconn;
    TCHAR szEntryName[RAS_MaxEntryName + 1];

    #if (WINVER >= 0x400)
    TCHAR szDeviceType[ RAS_MaxDeviceType + 1 ];
    TCHAR szDeviceName[ RAS_MaxDeviceName + 1 ];
    #endif
    #if (WINVER >= 0x401)
    TCHAR szPhonebook [ MAX_PATH ];
    DWORD dwSubEntry;
    #endif
    #if (WINVER >= 0x500)
    GUID guidEntry;
    #endif
    } RASCONN ;

    Members
    dwSize
    Specifies the size, in bytes, of the RASCONN structure.
    hrasconn
    Specifies the remote access connection. This handle is used in other remote access API calls.
    szEntryName
    A string that specifies the phone-book entry used to establish the remote access connection. If the connection was established using an empty entry name, this string consists of a PERIOD followed by the connection phone number.
    szDeviceType
    Windows NT 4.0 and later: A null-terminated string that contains the device type through which the connection is made.
    szDeviceName
    Windows NT 4.0 and later: A null-terminated string that contains the device name through which the connection is made.
    szPhonebook [ MAX_PATH ]
    Windows NT 4.0 and later: The full path and filename to the phonebook containing the entry for this connection.
    dwSubEntry
    Windows NT 4.0 and later: For multilink connections, specifies the subentry index of one of the connected links. Subentry indices are one based.
    guidEntry
    Windows NT 5.0 and later: A GUID (Globally Unique IDentifier) that represents the phone-book entry. The value of this member corresponds to that of the guidid member in the RASENTRY structure.

    --------------------------

    Regards
    Paul Lewis

  3. #3
    Guest

    Cool

    Paul,

    Suggestion, place it in a ["code"] (No Quotes) tag, like:

    Code:
    Public Define as Object
    
    Public or Private 'This is an example.
    
    Set x
    Get x

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width