方法一:测试当前是否联网
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 := " "
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)
}
?