Solved

Call an connection on WindowsXP

Posted on 2003-11-11
5
288 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now