Seit WIN 2000 gibt es die Funktion
InternetGetConnectedState(WinInet).
Ist aber ohne Aussagekraft...
Es gibt USB-Sticks, die als MODEM erkannt werden, andere als LAN.
http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx
Delphi-Quellcode:
Function IsConnectedToInternet: Boolean;
var
dwConnectionTypes: DWORD;
begin
dwConnectionTypes :=
INTERNET_CONNECTION_MODEM + INTERNET_CONNECTION_LAN +
INTERNET_CONNECTION_PROXY + INTERNET_CONNECTION_MODEM_BUSY;
Result := InternetGetConnectedState(@dwConnectionTypes, 0);
end;
oder:
Function INETconnectionType: String;
var State: DWord; Result1: Boolean;
const
Type1 = INTERNET_CONNECTION_MODEM;
Type2 = INTERNET_CONNECTION_LAN;
Type3 = INTERNET_CONNECTION_PROXY;
Type4 = INTERNET_CONNECTION_MODEM_BUSY;
begin
Result:='';
Result1:=InternetGetConnectedState(@State, 0);
if Result1 then
begin
if (State and Type1) = Type1 then Result:= 'Modem ';
if (State and Type2) = Type2 then Result:= 'LAN';
if (State and Type3) = Type3 then Result:= 'Proxy';
if (State and Type4) = Type4 then Result:= 'Modem busy';
end;
end;