function GetNetworkState: string; // 得到当前网络连接状态
var
NS: TNetworkState;
begin
NS := TNetworkState.Create;
try
if not NS.IsConnected then // 无网络
result := ‘0‘
else if NS.IsWifiConnected then // wifi
result := ‘1‘
else if NS.IsMobileConnected then // 移动数据
result := ‘2‘;
finally
NS.Free;
end;
end;
原文地址:https://www.cnblogs.com/wcf-delphi/p/8616106.html
时间: 2024-11-25 16:28:28