Solved

Call an connection on WindowsXP

Posted on 2003-11-11
5
294 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dev Express grid collapse 2 54
How to renew a Delphi rad-studio licence? 5 94
Create a path if not exists 7 124
SQL Server Express automatically execute SQL or SP 8 64
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

732 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