?
Solved

Call an connection on WindowsXP

Posted on 2003-11-11
5
Medium Priority
?
298 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
4 Comments
 
LVL 1

Assisted Solution

by:JackNaif
JackNaif earned 1050 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 450 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 1050 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Loops Section Overview
Suggested Courses

840 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