DELPHI 判断当前网络连接方式


DELPHI 判断当前网络连接方式
//添加单元 wininet
function ConnectionKind:BOOLean;
var
flags:DWORD;
begin
if InternetGetConnectedState(@flags,0) then // API函数
begin
if (flags and INTERNET_CONNECTION_MODEM)=INTERNET_CONNECTION_MODEM then //拨号
ShowMessage('modem');
if (flags and INTERNET_CONNECTION_LAN) = INTERNET_CONNECTION_LAN then //局域网
ShowMessage('lan');
if (flags and INTERNET_CONNECTION_PROXY) = INTERNET_CONNECTION_PROXY then //代理上网
showmessage('Proxy');
if (flags and INTERNET_CONNECTION_MODEM_BUSY)=INTERNET_CONNECTION_MODEM_BUSY then //不在线 www.delphitop.com
showmessage('Modem Busy');
end ;
end;


{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
ConnectionKind();
end;
end.
联系电话:
020-00000000
联系电话:
020-00000000
联系电话:
020-12345678