Solved

Call an connection on WindowsXP

Posted on 2003-11-11
5
292 Views
Last Modified: 2010-04-05
How I can call a internet connection in WindowsXP?
In Windows98 I can use the RAS, but how I can execute a connection created in WindowsXP?

Thanks for All.
0
Comment
Question by:zezons
  • 2
5 Comments
 
LVL 1

Assisted Solution

by:JackNaif
JackNaif earned 350 total points
ID: 9725247
Have you tried something like:

uses RasAPI;

 function OpenConnection( PhoneNumber: String; UserName: String; Password: String; EntryName: String; Var rasConn:
 HRASConn ): DWORD;
 Var
    lpRasDialParams : PRASDIALPARAMS;
 Begin
    GetMem( lpRasDialParams, SizeOf( lpRasDialParams^ ) );
    lpRasDialParams^.dwSize := SizeOf( lpRasDialParams^ );
    StrCopy( @(lpRasDialParams^.szEntryName ), PCHAR( EntryName ) );
    StrCopy( @(lpRasDialParams^.szUserName) , PCHAR( UserName ) );
    StrCopy( @(lpRasDialParams^.szPassword ), PCHAR( Password ) );
    StrCopy( @(lpRasDialParams^.szPhoneNumber ), PCHAR( PhoneNumber ) );
    StrCopy( @(lpRasDialParams^.szCallbackNumber ), PCHAR( '' ) );
    StrCopy( @(lpRasDialParams^.szDomain ), PCHAR( '' ) );

    Result := RasDial( Nil { lpRasDialExtensions : PRASDIALEXTENSIONS ; pointer to function extensions data },
                       Nil { lpszPhonebook: PChar;        pointer to full path and filename of phonebook file },
                       lpRasDialParams { pointer to calling parameters data},
                       0 { dwNotifierType : DWORD;       specifies type of RasDial event handler},
                       0 { lpvNotifier: DWORD;        specifies a handler for RasDial events},
                       rasConn { pointer to variable to receive connection handle}
                     );
    FreeMem( lpRasDialParams );
 End;

 Function CloseConnection( rasConn: HRASConn ): Boolean;
 Begin
    If rasConn <> 0
    Then Result := ( RasHangUp(rasConn) = 0 )
    Else Result := True;
 End;

 
Hope it helps:

Jack
0
 
LVL 4

Assisted Solution

by:BedouinDN
BedouinDN earned 150 total points
ID: 9725791
Or there are components you can use that encapsulate the RAS API - Best ones I have come across so far are the TMagRAS component set.
Get them here: http://www.magsys.co.uk/delphi/
Also might like to check out the TurboPower APro component set available on sourceforge.net
0
 

Author Comment

by:zezons
ID: 9730662
I Must be Call the default exists dial connection.

I'm using this code:

      reg := TRegIniFile.create('RemoteAccess\');
      Conection := reg.ReadString('','Default','');
      reg := nil;
      reg.free;
      Exec:='rundll32.exe rnaui.dll,RnaDial ';
      Conection:=Exec+Conection;
      Winexec(Pchar(Conection),sw_show);
0
 
LVL 1

Accepted Solution

by:
JackNaif earned 350 total points
ID: 9731804
Well I'm not really sure of how you use the existing DUN connectoids (the icons for the existing connections). I never really had the time to look into it. But I believe what you're missing is to get the RAS default Phonebook Entry and use the data you get from there to fill in the fields of lpRasDialParams^ (or the arguments of the OpenConnection function).

If I had the time, I'd probably read it from a set of articles to be found at:

http://www.kyler.com/pubs/ddj9855.php?obj=pubs

They look accurate and thorough enough.

Hope it helps:

Jack
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question