Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted

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

Posted

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

  • Moderators
Posted

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.

Posted

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.

Posted (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 by Rick

Who needs puzzles when we have AutoIt!!

Posted (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 by IcyFerno
Posted

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

;) Fully true.. Thanks white tiger

-jaenster

Posted

; 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

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
  • Recently Browsing   0 members

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