Buscar

Checar o tipo de conexão com a internet

Código

{Declare a uses: Wininet

Declare uma função com a seguinte instrução:}


function ConnectionKind: Boolean;
var
flags: DWORD;
begin
Result := InternetGetConnectedState(@flags, 0);
if Result then
begin
if (flags and INTERNET_CONNECTION_MODEM) = INTERNET_CONNECTION_MODEM
then
ShowMessage('Modem');
if (flags and INTERNET_CONNECTION_LAN) = INTERNET_CONNECTION_LAN then
ShowMessage('LAN');
if (flags and INTERNET_CONNECTION_PROXY) = INTERNET_CONNECTION_PROXY
then
ShowMessage('Proxy');
if (flags and INTERNET_CONNECTION_MODEM_BUSY) =
INTERNET_CONNECTION_MODEM_BUSY then
ShowMessage('Modem Busy');
end;
end;


Em um botão coloque o seguinte código:

procedure TForm1.Button1Click(Sender: TObject);
begin
ConnectionKind;
end;

 

Publicidade

Vote na dica




Quantidade de votos: 0 votos
Aceitação: 0%


Detalhes da dica

Categoria: Rede
Adicionada dia: 07/08/03
Por: Amilton Maciel
Visualizada: 3908 vezes

Planeta Delphi - Tudo sobre programação Delphi Planeta Delphi - www.planetadelphi.com.br - Todos os direitos reservados | Copyright 2001-2009