#include<array.au3>
;;;检测本地连接是否已经连接
$_Return= DllCall("WinInet.dll","int","InternetGetConnectedState","int_ptr",0,"int",0)
;~ _ArrayDisplay($_Return)
If $_Return[0] = 1 Then
MsgBox(0,"","本地连接已就绪!")
Else
MsgBox(0,"","本地连接错误或网络被拨出!")
EndIf
$INTERNET_CONNECTION_MODEM = 0x1
$INTERNET_CONNECTION_LAN = 0x2
$INTERNET_CONNECTION_PROXY = 0x4
$INTERNET_CONNECTION_MODEM_BUSY = 0x8
$INTERNET_RAS_INSTALLED = 0x10
$INTERNET_CONNECTION_OFFLINE = 0x20
$INTERNET_CONNECTION_CONFIGURED = 0x40
;~ http://msdn.microsoft.com/en-us/library/aa384702(VS.85).aspx
;;检查intelel是否已经连接
Local $sz_url = "http://www.google.com"
Local $u_flags = 0x00000001
Local $u_reserved = 0
Local $a_ret_val = DllCall("WinInet.dll", "int", "InternetCheckConnection", "str", $sz_url, "uint", $u_flags, "uint", $u_reserved)
ConsoleWrite($sz_url & " is connected = " & ($a_ret_val[0] <> 0) & @CRLF)
MsgBox(0,"",$sz_url & " is connected = " & ($a_ret_val[0] <> 0) & @CRLF)
;~ http://msdn.microsoft.com/en-us/library/aa384346(VS.85).aspx
|