1 2 { You must be connected to the internet and don't forget to add this 3 unit to get it to work :-) }4 5 uses wininet;
6 7 8 function KindOfConnection :boolean;
9 var10 flags: dword;
11 begin12 Result := InternetGetConnectedState(@flags, 0);
13 if Result then14 begin15 if (flags and INTERNET_CONNECTION_MODEM) = INTERNET_CONNECTION_MODEM then16 begin17 showmessage('Modem');
18 end;
19 if (flags and INTERNET_CONNECTION_LAN) = INTERNET_CONNECTION_LAN then20 begin21 showmessage('LAN');
22 end;
23 if (flags and INTERNET_CONNECTION_PROXY) = INTERNET_CONNECTION_PROXY then24 begin25 showmessage('Proxy');
26 end;
27 if (flags and INTERNET_CONNECTION_MODEM_BUSY)=INTERNET_CONNECTION_MODEM_BUSY
28 then29 begin30 showmessage('Modem Busy');
31 end;
32 end;
33 end;
34 35 procedure TForm1.Button1Click(Sender: TObject);
36 begin37 KindOfConnection;
38 end;