Jump to content

Internet Status


DarkHo
 Share

Recommended Posts

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

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

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