Skip to content

Commit

Permalink
Fix isInternetConnected method
Browse files Browse the repository at this point in the history
  • Loading branch information
SaifAqqad committed May 13, 2022
1 parent 1b8551a commit f479897
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Updater.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,19 @@ class Updater {
}

isInternetConnected(){
return DllCall("Wininet.dll\InternetGetConnectedState", "Str", 0x43, "Int", 0)
if(!DllCall("Wininet.dll\InternetGetConnectedState", "Str", 0x43, "Int", 0))
return 0
http := ComObjCreate("WinHttp.WinHttpRequest.5.1")
try{
http.Open("HEAD", "https://api.github.com", false)
http.send()
}catch e {
ObjRelease(http)
return 0
}
is_success:= http.Status == 200
ObjRelease(http)
return is_success
}

downloadToFile(url, name){
Expand Down

0 comments on commit f479897

Please sign in to comment.