Solved

Detect Ras connection

Posted on 1998-12-02
4
369 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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 my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 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

26 Experts available now in Live!

Get 1:1 Help Now