Mega Code Archive

 
Categories / Delphi / LAN Web TCP
 

Determining The Internet Connection Type

Title: Determining The Internet Connection Type . Question: How can i determine the current type of internet connection, am i using a proxy or not....& more ???? Answer: uses wininet; 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 begin showmessage('Modem'); end; if (flags and INTERNET_CONNECTION_LAN) = INTERNET_CONNECTION_LAN then begin showmessage('LAN'); end; if (flags and INTERNET_CONNECTION_PROXY) = INTERNET_CONNECTION_PROXY then begin showmessage('Proxy'); end; if (flags and INTERNET_CONNECTION_MODEM_BUSY)=INTERNET_CONNECTION_MODEM_BUSY then begin showmessage('Modem Busy'); end; end; end; procedure TForm1.Button1Click(Sender: TObject); begin ConnectionKind; end;