原文:http://www.autohotkey.com/forum/viewtopic.php?p=60892#60892
方法一:
If ConnectedToInternet()
Msgbox, 64, WinInet.dll, ONLINE!
else
Msgbox, 48, WinInet.dll, OFFLINE!
Return
ConnectedToInternet(flag=0x40) {
Return DllCall("Wininet.dll\InternetGetConnectedState", "Str", flag,"Int",0)
}
方法二:
URL := "http://www.autohotkey.com"
If InternetCheckConnection(URL)
Msgbox, 64, WinInet.dll [%URL%], Connection Success!
else
Msgbox, 48, WinInet.dll [%URL%], Connection Failed!
Return
; The Function
InternetCheckConnection(Url="",FIFC=1) {
Return DllCall("Wininet.dll\InternetCheckConnectionW", Str,Url, Int,FIFC, Int,0)
}