本文整理自网络,侵删。
use WinInet;
//正确检测是否在线方法
if InternetGetConnectedState(nil, 0) then
begin
Self.Caption := '在线';
end
else
begin
Self.Caption := '脱机';
end;
经测试,和QQ检测是否在线基本相同。
相关阅读 >>
python4Delphi 示例应用程序在 Delphi 应用程序中运行简单的 python 脚本
Delphi 10 下提示sharedactivitycontext错误的解决方法
更多相关阅读请进入《Delphi》频道 >>