Delphi 快速检测是否联网 判断网线是否拔开。 但是不能判断是否能上网

https://blog.csdn.net/chelen_jak/article/details/50204145

Delphi 快速检测是否联网

转自: http://www.delphitop.com/html/wangluo/2990.html

use WinInet; 
  //正确检测是否在线方法
  if InternetGetConnectedState(nil, 0) then
  begin
    Self.Caption := '在线';
  end
  else
  begin
    Self.Caption := '脱机';
  end;
经测试,和QQ检测是否在线基本相同。

猜你喜欢

转载自www.cnblogs.com/delphi-xe5/p/10947399.html