WhiteTiger Posted November 12, 2006 Posted November 12, 2006 func checkinet() $f_con = DllCall("wininet.dll","Dword","InternetAttemptConnect") if $f_con <> 0 then DllCall("wininet.dll","dword","InternetAttemptConnect") $f_con = DllCall("wininet.dll","Dword","InternetAttemptConnect") if $f_con <> 0 then Return -1 EndIf EndIf $f_open = DllCall("wininet.dll","dword","InternetOpen","Dword","dwAccesType") if not $f_open = 0 then Return $f_open EndFunc This will return 0 if connecton is good , else it wil return a systemError number :-) i hope some-one might think its usefull :-)
masvil Posted November 12, 2006 Posted November 12, 2006 It works here. In which cases it can be better than ping to microsoft or google?
clearguy Posted November 12, 2006 Posted November 12, 2006 I'm not knowing much about dll's, but it seems to be a much better way to check the inet connection than ping or so... Nice I've never met anyone who codes binary. StringMultiInsert()SOW EncryptFrench autoit forum - forum français
clearguy Posted November 12, 2006 Posted November 12, 2006 It works here. In which cases it can be better than ping to microsoft or google?If servers are down... I've never met anyone who codes binary. StringMultiInsert()SOW EncryptFrench autoit forum - forum français
NELyon Posted November 12, 2006 Posted November 12, 2006 What are the chances of both google and Microsoft being down? Works fine here. Nice function
IcyFerno Posted November 12, 2006 Posted November 12, 2006 ok this is cool, but is you are not connected, it shd display as?
MHz Posted November 12, 2006 Posted November 12, 2006 You call "InternetAttemptConnect" 3 times if ok connection?, but then call "InternetOpen" when no connection exists which opens a handle which you may need to close with "InternetCloseHandle". The UDF seems to be incomplete.
WhiteTiger Posted November 12, 2006 Author Posted November 12, 2006 You call "InternetAttemptConnect" 3 times if ok connection?, but then call "InternetOpen" when no connection exists which opens a handle which you may need to close with "InternetCloseHandle". The UDF seems to be incomplete.nope :-) it checks if there's is a connection , if it inst , it try's to connect , if it still isnt online then it returns an error , else it prepare's a connection , just in case windows doesnt do this automaticly :-)and thanks for the nice reply's
IcyFerno Posted November 13, 2006 Posted November 13, 2006 nope :-) it checks if there's is a connection , if it inst , it try's to connect , if it still isnt online then it returns an error , else it prepare's a connection , just in case windows doesnt do this automaticly :-)erm, i doubt windows will not be that stupid to attemp a reconnection...
WhiteTiger Posted November 13, 2006 Author Posted November 13, 2006 erm, i doubt windows will not be that stupid to attemp a reconnection...im sure about 1 thing , windows isnt smart
Moderators SmOke_N Posted November 13, 2006 Moderators Posted November 13, 2006 im sure about 1 thing , windows isnt smartSmarter than most end-users... Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
IcyFerno Posted November 13, 2006 Posted November 13, 2006 Smarter than most end-users...lol good comment :applause:
Richard Robertson Posted November 13, 2006 Posted November 13, 2006 Windows isn't smart. I think Windows needs an implementation of Alice. Then she could help people who have issues. That is what Windows needs.
Valik Posted November 14, 2006 Posted November 14, 2006 But with Microsoft's track record, the only thing that would end up with issues would be the ALICE implementation and then the frustration from dealing with an artificially stupid operating system would drive people to other issues.
Rick Posted November 15, 2006 Posted November 15, 2006 (edited) ; $IsCon[0] = 0 not connected, $IsCon[0] = 1 is connec. $IsCon=DllCall("WinInet.dll","int","InternetGetConnectedState","int_ptr",0,"int",0) MsgBox(4096,"",$IsCon[0]) short and sweet sorry, a type error corrected Edited November 26, 2006 by Rick Who needs puzzles when we have AutoIt!!
IcyFerno Posted November 15, 2006 Posted November 15, 2006 (edited) thanks for your contribution. i needed this in my script which requires to check a connection but i noticed that this is quite slow when my script is at this part any way to do this faster? Edited November 15, 2006 by IcyFerno
jaenster Posted November 16, 2006 Posted November 16, 2006 I'm not knowing much about dll's, but it seems to be a much better way to check the inet connection than ping or so...Nice Fully true.. Thanks white tiger -jaenster
WhiteTiger Posted November 19, 2006 Author Posted November 19, 2006 Fully true.. Thanks white tigerno problem :-) just doing my job (hmm that doesnt sound bad , does it ?)
anixon Posted November 26, 2006 Posted November 26, 2006 ; 0 = not connected 1 is connected. $IsCon=DllCall("WinInet.dll","int","InternetGetConnectedState","int_ptr",0,"int",0) MsgBox(4096,"",$IsCon[0]) short and sweet Very nice but how do you wrap around a while or do statement that requires the result to the dllcall to be 1 before continuing to run the script? Ant
the DtTvB Posted November 26, 2006 Posted November 26, 2006 Wow, new knowledge! I use _getIP! [right]Please visit: My biggest project, the DtTvB's AutoIt Web ServerOlder Stuff: A Smoother MouseMove :: AutoIt Syntax Highlighter[/right]
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now