Jump to content
Sign in to follow this  
DarkHo

Internet Status

Recommended Posts

DarkHo

I was bored and i made this funny thing hehe. The Picture will switch if you don't have internet to red.

Hop you like it

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
GUICreate("Status", 140, 50)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

HotKeySet("{F1}", "Terminate")

TrayTip("Tip", "To Exit the program press F1", 0, 1)

        While 1
        $var = Ping("www.google.com",250)

        If $var Then
        GUICtrlCreateIcon("online.ico", -1, 49, 5, 39, 39, BitOR($SS_NOTIFY,$WS_GROUP))
        Else
        GUICtrlCreateIcon("offline.ico", -1, 49, 5, 39, 39, BitOR($SS_NOTIFY,$WS_GROUP))
    EndIf
    Sleep(2000)
        WEnd
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE


    EndSwitch
WEnd

Func Terminate()
    Exit 0
EndFunc

Have fun :mellow:

Internet Status.zip

Edited by DarkHo

Share this post


Link to post
Share on other sites
dmob

's not a good idea to ping the same address too many times,

plus the website might be too busy to respond before your timeout.

Some suggestions:

- Create an array with lots of addresses then ping each one in turn

- Ping at least three addresses before you report offline

Just my two cents worth....

Edited by dmob

Share this post


Link to post
Share on other sites
JRowe

Get a list of google addresses, instead of pinging the domain name. Random addresses conceivably might go down, but it's highly unlikely that any significant cluster of google servers will crash at any given time.

Good thinking, dmob. :mellow:

Edited by JRowe

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.