找回密码
 加入
搜索
查看: 1901|回复: 5

如何判断网络断线

[复制链接]
发表于 2009-2-5 16:35:28 | 显示全部楼层 |阅读模式
如何判断网络断线 用什么可以判断 现在 已经断线了
发表于 2009-2-5 16:44:48 | 显示全部楼层
http://939825342.qzone.qq.com/blog/1232029480
这个满足你 ,自己参考,弄错了,重新发!

[ 本帖最后由 wolfxiong 于 2009-2-6 08:59 编辑 ]
发表于 2009-2-5 17:02:01 | 显示全部楼层
PING某个网址啊 不通就断
发表于 2009-2-5 17:18:12 | 显示全部楼层
直接用PING命令啊
PING ($DnsIP)
If @error Then
。。。。断线执行什么操作       
Else
。。。。没有断线扫行什么操作
EndIf

$DnsIP可以为本地区的电信DNS
 楼主| 发表于 2009-2-5 20:51:05 | 显示全部楼层
这个我知道  没有其其它的方法了?
发表于 2009-2-6 09:00:28 | 显示全部楼层
$connect = _GetNetworkConnect() 
If $connect Then 
    MsgBox(64, "Connections", $connect) 
Else 
    MsgBox(48, "Warning", "There is no connection") 
EndIf 
Func _GetNetworkConnect() 
    Local Const $NETWORK_ALIVE_LAN = 0x1  ;net card connection 
    Local Const $NETWORK_ALIVE_WAN = 0x2  ;RAS (internet) connection 
    Local Const $NETWORK_ALIVE_AOL = 0x4  ;AOL 
     
    Local $aRet, $iResult 
     
    $aRet = DllCall("sensapi.dll", "int", "IsNetworkAlive", "int*", 0) 
     
    If BitAND($aRet[1], $NETWORK_ALIVE_LAN) Then $iResult &= "LAN connected" & @LF 
    If BitAND($aRet[1], $NETWORK_ALIVE_WAN) Then $iResult &= "WAN connected" & @LF 
    If BitAND($aRet[1], $NETWORK_ALIVE_AOL) Then $iResult &= "AOL connected" & @LF 
     
    Return $iResult 
EndFunc
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-23 07:28 , Processed in 0.077403 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表