Uses部分加上WinInet
function CheckOffline: boolean;
var
ConnectState: DWORD;
StateSize: DWORD;
begin
ConnectState:= 0;
StateSize:= SizeOf(ConnectState);
result:= false;
if InternetQueryOption(nil, INTERNET_OPTION_CONNECTED_STATE, @ConnectState, StateSize) then
begin
if (ConnectState and INTERNET_STATE_DISCONNECTED) <> 2 then
begin
if InternetCheckConnection(nil, 1, 0) then
Result:=True;
end;
end;
end;