Jump to content

Checkinet


WhiteTiger
 Share

Recommended Posts

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 :-)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

  • Moderators

im sure about 1 thing , windows isnt smart

Smarter 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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

; $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 by Rick

Who needs puzzles when we have AutoIt!!

Link to comment
Share on other sites

; 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
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...