[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Detect Internet DialUp connections

Posted on 1998-11-27
8
Medium Priority
?
180 Views
Last Modified: 2010-04-04
Hi All,

I want to write a little application to detect internet dialup connections and launchs my application (like ICQ NetDetect). How can I do that?

Thanks in advance.
0
Comment
Question by:sergio_2001
[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
  • 2
  • 2
8 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 150 total points
ID: 1348263
sergio_2001,

you can use something like below to check 'remote connection' key it changes when a ras connection is made.
to see what i mean run regedit and check HKEY_LOCAL_MACHINE\
System\CurrentControlSet\Services\RemoteAccess\remote connection  value then close regedit and connect to net
and reopen regedit and recheck you'll see value has changed.

Function GetRasStatus:Longint;   { get number of RAS onnections }var
MyRegistry:TRegistry;
begin         { Change registry to load every time }
MyRegistry:=TRegistry.Create;
With MyRegistry dobegin
RootKey:=HKEY_LOCAL_MACHINE;
OpenKey('System\CurrentControlSet\Services\RemoteAccess',True);
ReadBinaryData('Remote Connection',Result,SizeOf(Result));
CloseKey;
end;
MyRegistry.Free;
end;
Function DetectConnection:Boolean;
var
IPList:TStrings;
begin
IPList:=LocalIPList;
Result:=IPList.Count<>0;
If GetRasStatus>0 then Result:=True;
end;

Barry,
0
 

Author Comment

by:sergio_2001
ID: 1348264
inthe,

Your  answer looks good. But I have some problems with the function:

Function DetectConnection:Boolean;
    var
    IPList:TStrings;
    begin
    IPList:=LocalIPList; {where is declared? or what I must include here?}
    Result:=IPList.Count<>0;
    If GetRasStatus>0 then Result:=True;
end;

The IPList:=LocalIPList; ?????

Waiting for comments...
thanks
0
 
LVL 17

Expert Comment

by:inthe
ID: 1348265
hi,
i'll post a full unit tonight gmt time
you dont have to use some of the lines just getting status of key in registry will do
Regards Barry

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 17

Expert Comment

by:inthe
ID: 1348266
Hi Sergio
1 button on form with a onclick event

unit Unit1;

interface

uses
  Windows, Messages,Registry, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    procedure Button1Click(Sender: TObject);
  private
   
  public
   
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}
Function GetRasStatus:Longint;
var
MyRegistry:TRegistry;
begin
MyRegistry:=TRegistry.Create;
With MyRegistry do begin
RootKey:=HKEY_LOCAL_MACHINE;
OpenKey('System\CurrentControlSet\Services\RemoteAccess',True);
ReadBinaryData('Remote Connection',Result,SizeOf(Result));
CloseKey;
end;
MyRegistry.Free;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
edit1.text:=inttostr(getrasstatus);
end;

end.
 Regards Barry
0
 
LVL 17

Expert Comment

by:inthe
ID: 1348267
sorry dude wrong one here is correct one:
unit Unit1;

interface

uses
  Windows, Messages,Registry,shellapi, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;
type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
  public
    end;

var
  Form1: TForm1;

implementation

{$R *.DFM}
Function GetRasStatus:Longint;
var
MyRegistry:TRegistry;
begin
MyRegistry:=TRegistry.Create;
With MyRegistry do begin
RootKey:=HKEY_LOCAL_MACHINE;
OpenKey('System\CurrentControlSet\Services\RemoteAccess',True);
ReadBinaryData('Remote Connection',Result,SizeOf(Result));
CloseKey;
end;
MyRegistry.Free;
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
if  getrasstatus = 1
then
ShellExecute(Handle, NIL, 'c:\windows\calc.exe', NIL, NIL, sw_ShowNormal)
else showmessage('not connected');
end;

end.
 
0
 

Author Comment

by:sergio_2001
ID: 1348268
Hi inthe,

I will evaluate your answer to grade you ASAP.

regards
0
 

Expert Comment

by:Mikkel_48
ID: 22583005
I have a very similar requirement to the original question. In my case I wish to keep a log of times and dates I am connected to the internet via my Dial-Up Connection The solution should work on Windows 2000 upwards to Vista and be compatible with Delphi.
I looked at the provided solution but in my Windows (XP, SP3) if I look at the registry key specified 'System\CurrentControlSet\Services\RemoteAccess', there is no binary data value ''Remote Connection'. Am I missing something or was that correct for Windows 98, but later versions don't have it?
Any comments from the solution provider (or the question poster)? I am happy to pose a new question if necessary.
0
 

Expert Comment

by:Mikkel_48
ID: 22583519
Addendum to my previous comment:
I would still like the solution providers comments on his solution and curent Windows compatibility but some searching has revealed many questions and solutions on this topic and it will take me some time to research and test them all. Therefore not going to post a new question yet.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

650 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