Know the kind of inet connection in use  

Send By: Arturo Garcia
Web : N.A.
Email: sArthur7@teleline.es
Date: 14/07/00

Tip accessed 460 times

 


  • Add WinInet in the uses of you form
  • Abd put this code into a OnClick event of any TButton:


     procedure TForm1.Button1Click(Sender: TObject);
    
       Function HayConexion:boolean;
       var
         flags: dword;
       begin
          Result := InternetGetConnectedState(@flags, 0);
         if Result then begin
          showmessage('Conexion a Internet Activa');
          if (flags and INTERNET_CONNECTION_MODEM) = INTERNET_CONNECTION_MODEM then
             showmessage('Conexion por modem');
          if (flags and INTERNET_CONNECTION_LAN) = INTERNET_CONNECTION_LAN then
             showmessage('Conexion por lan');
          if (flags and INTERNET_CONNECTION_PROXY) = INTERNET_CONNECTION_PROXY then
             showmessage('Conexion por proxy');
          if (flags and INTERNET_CONNECTION_MODEM_BUSY) =INTERNET_CONNECTION_MODEM_BUSY then
             showmessage('modem busy');
         end;
       end;
     begin
       HayConexion;
     end;
    



    NOTE: In my Delphi 3, in the WinInet.PAS file it is not declared the InternetGetConnectedState, function...


    Updated at 14/07/2000 (one ';' missing...)