Solved

Detect Ras connection

Posted on 1998-12-02
4
379 Views
Last Modified: 2010-04-04
How can I detect a RAS connection lunched by a specific adapter or modem ?

(Please NT and Win95 answer)
0
Comment
Question by:borgo
4 Comments
 
LVL 5

Expert Comment

by:ronit051397
ID: 1349017
Download this free component:
http://sme.belgium.eu.net/~vip107/rasdial.zip
0
 
LVL 1

Accepted Solution

by:
venks earned 50 total points
ID: 1349018
Use the TFnugryRASNotify Component available from Delphi super page or Torry's delphi page
I am giving the help file to solve your problem
TFnugryRASNotify Component

Overview

Fnugry RASNotify Component can be used to notify your application when RAS connection becomes available or  lost. It also allows developer to easily enumerate all RAS connections, query name, device or status of any connection, etc.

Component Reference

Properties

Enabled      

property Enabled :Boolean;

Use Enabled to enable/disable notifications.

PollInterval

property PollInterval :Integer;

The PollInterval property specifies a number of milliseconds between connection stack polls. Set it to a smaller value for application that should quickly respond to connection state changes.


ConnCount

property ConnCount :Integer;

Read ConnCount to determine a number of RAS connections in the system.

ConnHandle

property ConnHandle[Index :Integer] :THandle;

Read ConnHandle to retrieve RAS connection handle.

ConnName

property ConnName[Index :Integer] :String;

ConnName returns name of the specified connection.

DeviceType

property DeviceType[Index :Integer] :String;

Use DeviceType to get type of the device associated with the connection.

DeviceName

property DeviceName[Index :Integer] :String;

DeviceName returns name of the device.
 
Online

property Online :Boolean;

Online property is true if there is at least one connection with the ‘Connected’ state.

Events

OnConnected

property OnConnected :TRASConnectedEvent;

  TRASConnectedEvent = procedure(Sender :TObject;
    hConn :THandle; const EntryName,
    DeviceType, DeviceName :String) of object;

OnConnected event is generated when a new RAS connection is established.

OnDisconnected

property OnDisconnected :TRASDisconnectedEvent;

  TRASDisconnectedEvent = procedure(Sender :TObject;
    hConn :THandle ) of object;

OnDisconnected is called when connection is lost.


 Interface Declaration

type


  ERASNotifyError = class(Exception);

  TRASConnectedEvent = procedure(Sender :TObject;
    hConn :THandle; const EntryName,
    DeviceType, DeviceName :String) of object;

  TRASDisconnectedEvent = procedure(Sender :TObject;
    hConn :THandle ) of object;


  TFnugryRASNotify = class(TComponent)
  protected
    procedure ValidateEntryIndex(Value :Integer);
    procedure Loaded; override;
    procedure Connected(hConn :THandle;
      const EntryName, DeviceType, DeviceName :String); virtual;
    procedure Disconnected(hConn :THandle); virtual;
    procedure DoEnable; virtual;
    procedure DoDisable; virtual;
    procedure ResetList;
    procedure ClearList;
    procedure UpdateList;
  public
    constructor Create(AOwner :TComponent); override;
    destructor Destroy; override;
    property ConnCount :Integer;
    property ConnHandle[Index :Integer] :THandle
    property ConnName[Index :Integer] :String
    property DeviceType[Index :Integer] :String
    property DeviceName[Index :Integer] :String
    property Online :Boolean
  published
    property Enabled :Boolean
    property PollInterval :Integer;
    property OnConnected :TRASConnectedEvent;
    property OnDisconnected :TRASDisconnectedEvent;
    property OnEnable :TNotifyEvent;
    property OnDisable :TNotifyEvent;
  end;


regards
venks
0
 
LVL 4

Expert Comment

by:BoRiS
ID: 1349019
borgo

You can use the RasGetConnectionStatus API call

RasGetConnectStatus(
rasconn,      // handle to RAS connection of interest
rasconnstatus      // buffer to receive status data
 );

Check the win32.hlp for more info on the structures etc...

Later
BoRiS
0
 

Author Comment

by:borgo
ID: 1349020
Ok, I will try Venks. I trust you :-) so I give you Excelent.
But you didn't tell me if it also works on Win95/98.
Can you help me please ?

Bye
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Intraweb submit form as a POST request 4 302
How to debug For loops? 3 49
can't find the executable in Simulator 1 90
Tidtcpserver listening on multiports? 1 26
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…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

808 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