Problem with enable and disable buttons

Posts 1–2 of 2 · Page 1 of 1
Problem with enable and disable buttons
Hello everyone,

i have a problem with my code. I want to start notepad and then disable the button and when the windows close it must enable the button again.
But with my code now, i need to click 2 times and then it disable it, en when i close the 2 notepad windows it enables the button again. See code.

Code:
#RequireAdmin

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Global $Form1 = GUICreate("Form1", 615, 437, 557, 174)
Global $Button1 = GUICtrlCreateButton("Button1", 88, 56, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            Run("notepad.exe")
            GUICtrlSetState($Button1, $GUI_DISABLE)
            WinWaitClose("[CLASS:Notepad]")
            GUICtrlSetState($Button1, $GUI_ENABLE)

    EndSwitch

WEnd
I have solved the problem, i don't need anymore help.
Posts 1–2 of 2 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us