Solved

Detect a Broadband connection

Posted on 2004-03-22
6
304 Views
Last Modified: 2010-04-04
Hi,

I need a function that will do this:

if (user has a broadband connection) then showmessage('Broadband')

else if (user has a normal dial up connection) then showmessage('Dialup');
0
Comment
Question by:siwiher
[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
  • 3
  • 2
6 Comments
 
LVL 3

Expert Comment

by:concon
ID: 10648079
Hi siwiher,

here is an example code to detect internet connection. you could find out connection type by changing dwConnectionTypes variable value. this detects all kinds of connection.

uses
   WinInet;

function IsConnectedToInternet: Boolean;
var
  dwConnectionTypes: DWORD;
begin
  dwConnectionTypes :=
    INTERNET_CONNECTION_MODEM +
    INTERNET_CONNECTION_LAN +
    INTERNET_CONNECTION_PROXY;
  Result := InternetGetConnectedState(@dwConnectionTypes, 0);
end;

Regards.
0
 

Author Comment

by:siwiher
ID: 10648173
Concon >>

I'm a little inexperienced could you give me a working example which would
detect a broadband connection and dialup.

There's an extra 50 points in it for you if it works!
0
 
LVL 3

Expert Comment

by:marcoszorrilla
ID: 10650430
Here you have an example but dont forget for the points CONCON that has provided the function

Best Regards
Marcos.


unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}
function IsConnectedToInternet: Boolean;
var
  dwConnectionTypes: DWORD;
begin
  dwConnectionTypes :=
    INTERNET_CONNECTION_MODEM +
    INTERNET_CONNECTION_LAN +
    INTERNET_CONNECTION_PROXY;
  Result := InternetGetConnectedState(@dwConnectionTypes, 0);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
  if IsConnectedToInternet then
  ShowMessage('Conected')
  else
  ShowMessage('Not Conected');
  end;

end.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:siwiher
ID: 10651869
Sorry lads maybe i have not made myself clear - i can detect an internet connection

however I need my program to tell me what type it is - broadband or dialup

basically if the internet is always on I need to know about it

if the user uses a dialup then I need to make the distinction between the two!
0
 
LVL 3

Accepted Solution

by:
concon earned 250 total points
ID: 10655511
hi;

i have channged the procedure. maybe this helps.

// no connection returns 0
// dial-up returns 1
// broadband returns 2
function GetConnectionType: integer;
var
  dwConnectionTypes: DWORD;
begin
  dwConnectionTypes := INTERNET_CONNECTION_MODEM;
  if InternetGetConnectedState(@dwConnectionTypes, 0) then
     result := 1
  else
  begin
     dwConnectionTypes := INTERNET_CONNECTION_LAN + INTERNET_CONNECTION_PROXY;
     if InternetGetConnectedState(@dwConnectionTypes, 0) then
        result := 2
     else
        result := 0;
  end;
end;

regards.
0
 

Author Comment

by:siwiher
ID: 10655998
Thanks I'll try it when i get home
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
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…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses
Course of the Month11 days, 17 hours left to enroll

623 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