InternetGetConnectedState判断无效?为什么??
我把网线拔了,但还是显示'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;