Detect a connection

How can I detect when a internet connection is made while my program is running, and also to detect when a desconnection is made?
I appreciate the help

Luiz Paulo
luizpauloAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
intheConnect With a Mentor Commented:
hi,

uses wininet;
 
 
function IsConnectedToInternet : bool;
begin
dwConnectionTypes := INTERNET_CONNECTION_MODEM +
                          INTERNET_CONNECTION_LAN
                          + INTERNET_CONNECTION_PROXY;
 
    if InternetGetConnectedState(@dwConnectionTypes, 0) then
      Result := True
    else
      Result := False;
end;

Regards Barry
0
 
intheCommented:
btw
if that fails to work you can use the component here:

http://members.xoom.com/kirez/download.htm


0
 
luizpauloAuthor Commented:
Thanks, the code didn't worked but the component did just fine.
0
 
intheCommented:
great glad it helped :-)
0
All Courses

From novice to tech pro — start learning today.