InternetGetConnectedState判断无效?为什么??

gyx999 2003-04-17 09:30:40
我把网线拔了,但还是显示'Connected through LAN'
我试了很多方法,但都没办法判断网络是否通。
如果用InternetCheckConnection是可以,但在win98下会出现错误!

procedure TForm1.Button3Click(Sender: TObject);
Var
ConnectedState : DWord;
begin
if InternetGetConnectedState(@ConnectedState, 0) then
begin

if INTERNET_CONNECTION_MODEM and ConnectedState =
INTERNET_CONNECTION_MODEM then
ShowMessage('Connected through Modem');
if INTERNET_CONNECTION_PROXY and ConnectedState =
INTERNET_CONNECTION_PROXY then
ShowMessage('Proxy server configured');
if INTERNET_CONNECTION_LAN and ConnectedState =
INTERNET_CONNECTION_LAN then
ShowMessage('Connected through LAN');
end
else
ShowMessage('Not connected');
end;
...全文
69 点赞 收藏 4
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
gyx999 2003-04-18
难道没有办法吗
回复
gyx999 2003-04-18
不行!!!!
回复
brallow 2003-04-18
UPUPUP
回复
hch_45 2003-04-18
procedure TForm1.Button3Click(Sender: TObject);
Var
ConnectedState : DWord;
begin
ConnectedState:=INTERNET_CONNECTION_MODEM +INTERNET_CONNECTION_LAN+INTERNET_CONNECTION_PROXY;
if InternetGetConnectedState(@ConnectedState, 0) then
begin

if INTERNET_CONNECTION_MODEM and ConnectedState =
INTERNET_CONNECTION_MODEM then
ShowMessage('Connected through Modem');
if INTERNET_CONNECTION_PROXY and ConnectedState =
INTERNET_CONNECTION_PROXY then
ShowMessage('Proxy server configured');
if INTERNET_CONNECTION_LAN and ConnectedState =
INTERNET_CONNECTION_LAN then
ShowMessage('Connected through LAN');
end
else
ShowMessage('Not connected');
end;

试试...
回复
相关推荐
发帖
Delphi
创建于2007-08-02

4919

社区成员

Delphi 开发及应用
申请成为版主
帖子事件
创建了帖子
2003-04-17 09:30
社区公告
暂无公告