Solved

Call an connection on WindowsXP

Posted on 2003-11-11
5
295 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

691 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