Jump to content

doesn't close


 Share

Recommended Posts

How come the on event close does not seem to work?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Server Status", 80, 40)
$Label1 = GUICtrlCreateLabel("", 10, 10, 70, 20)
GUISetState(@SW_SHOW)

Gui()

Func Check()
    $var = Ping("75.150.216.162",250)
    If $var Then
        GUICtrlSetData($Label1, "Server Online")
    Else
        GUICtrlSetData($Label1, "Server Offline")
    EndIf
EndFunc

Func Gui()
    While 1
        $Msg = GUIGetMsg()
        If $Msg = $GUI_EVENT_CLOSE Then
            Exit
        EndIf
        Check()
        Sleep(500)
    WEnd
EndFunc
Link to comment
Share on other sites

The sleep(500) was "most" of the prob AFAIK

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $Ping_Complete = False

$Form1 = GUICreate("Server Status", 80, 40)
$Label1 = GUICtrlCreateLabel("", 10, 10, 70, 20)
GUISetState(@SW_SHOW)

Gui()

Func Check()
    $var = Ping("75.150.216.162", 250)
    If $var Then
        GUICtrlSetData($Label1, "Server Online")
    Else
        GUICtrlSetData($Label1, "Server Offline")
    EndIf
    $Ping_Complete = True
EndFunc   ;==>Check

Func Gui()
    While 1
        $Msg = GUIGetMsg()
        If $Msg = $GUI_EVENT_CLOSE Then
            Exit
        EndIf
        If Not $Ping_Complete Then Check()
    WEnd
EndFunc   ;==>Gui

8)

NEWHeader1.png

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