Solved

Detect Ras connection

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

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

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month7 days, 21 hours left to enroll

617 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