Solved

How to determine a modems connection speed

Posted on 2001-08-09
7
369 Views
Last Modified: 2010-04-06
How can you determine a modems connection speed (the b.p.s. rate) from within a Delphi application, while connected to a DUN connection?
0
Comment
Question by:DeveloperDan
7 Comments
 
LVL 5

Accepted Solution

by:
alanwhincup earned 200 total points
Comment Utility
You could try something like this:

Remember to add 'Registry' to the uses clause of the unit.

procedure TForm1.Button1Click(Sender: TObject);
var
  Reg : TRegistry;
  ConnectBuffer : array[0..3] of Byte;
  ConnectSpeed : LongInt;
begin
  Reg := TRegistry.Create;
  with Reg do
  begin
    RootKey := HKEY_DYN_DATA;
    if OpenKey('\PerfStats\StatData', False) then
    begin
      ReadBinaryData('Dial-Up Adapter\ConnectSpeed', ConnectBuffer, 4);
      ConnectSpeed := LongInt(ConnectBuffer);
      Label1.Caption := 'Connection Speed: ' + IntToStr(ConnectSpeed);
    end;
  end;
  Reg.Free;
end;

Cheers,

Alan
0
 
LVL 22

Expert Comment

by:mnasman
Comment Utility
0
 
LVL 22

Expert Comment

by:mnasman
Comment Utility
oops, forgot to include this page too
it's free but withoutsource code
http://members.nbci.com/onlinemeter/

0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 5

Expert Comment

by:Gwena
Comment Utility
listening :-)
0
 
LVL 5

Expert Comment

by:alanwhincup
Comment Utility
For Win 9x, you can check the performance counters in the registry to check the modem speed (as I've done above), but this is not available under the NT platform. The correct way to monitor the modem would be to use TAPI, to get the 'answered' event that reports the connection speed, this works on both Win 9x and NT. This would take alot of time and effort to code so the best solution i could find for you which would work in both platforms would be to use this component:

http://www.magsys.co.uk/delphi/index.shtml (TMagRas)
0
 
LVL 26

Expert Comment

by:Russell Libby
Comment Utility
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept alanwhincup's comment as answer

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Thank you,
Russell

EE Cleanup Volunteer
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 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

16 Experts available now in Live!

Get 1:1 Help Now