Jump to content

GUI Freeze


Recommended Posts

Sorry I'm new here. How  can I  prevent GUI freeze while the program is waiting for the answer from outside the program(specifically for answer from WindowsUpdateAgent).

I've been struggling with it for a while...  

❤️

Link to comment
Share on other sites

29 minutes ago, 20Ice18 said:

this is the code 

While True

        $nMsg = GUIGetMsg(1)

        #Region Buttons
        ;main GUI
        If $nMsg[1] = $Odin_GUI Then

            #Region Ready phase
            If $p_ready Then

                If $nMsg[0] = $chk_main[0] Then SelectAll()
                For $c = 1 To 3
                    If $nMsg[0] = $chk_main[$c] Then CheckBoxes()
                Next

                If $nMsg[0] = $btn_1win_set Then GUIWinSet()
                If $nMsg[0] = $btn_2update Then GUIUpdate()
                ;               If $nMsg[0] = $btn_3programs Then GUIPrograms()

                If $nMsg[0] = $btn_start Then
                    StartInstall()
                EndIf

            EndIf
            #EndRegion Ready phase

            If $nMsg[0] = $btn_log Then ShowHideLog()

            If $nMsg[0] = $GUI_EVENT_CLOSE Then
                CleanUp()
                Exit
            EndIf

            ;child GUI
        ElseIf $nMsg[1] = $GUI_child Then

            If $p_R_winset Then SelectWinSet($nMsg[0])
            If $p_R_update Then SelectUpdates($nMsg[0])
            ;           If $p_R_programs Then SelectPrograms($nMsg[0])

            ;Log GUI
        ElseIf $nMsg[1] = $GUI_log Then

            If $nMsg[0] = $GUI_EVENT_CLOSE Then ShowHideLog()

        EndIf
        #EndRegion Buttons

        #Region Actual installation
        If $p_I_winset Then Do_WinSet()
        If $p_I_update Then Do_Updates($nMsg[0])
        ;       If $p_I_programs Then Do_Programs()
        #EndRegion Actual installation

        If Not $p_ready Then UpdateInstallData()
        Sleep(10)

    WEnd

 

 

❤️

Link to comment
Share on other sites

i think that function  FindUpdates is freezing my gui but I'm not sure 

Func Terminate()
    ConsoleWrite("Waiting" & @CRLF)
    $result = MsgBox(262148, "Exit?", "Are you sure you want to exit?")
    If $result = 6 Then
        Exit 0
    EndIf
EndFunc   ;==>Terminate

Func MainLoop()
    Local $nMsg
    HotKeySet("{F1}", "Hotkeys")
    HotKeySet("{F2}", "Hotkeys")
    HotKeySet("{F3}", "Hotkeys")
    HotKeySet("{F4}", "Hotkeys")
    HotKeySet("{F5}", "Hotkeys")
    HotKeySet("{ESC}", "Terminate")




    If _ArraySearch($prog_Overall, "Next") <> -1 And $prog_Overall[4][1] <> "" Then
        If $prog_Overall[1][1] = "Next" Then MsgBox(32, "?", "") 
        StartInstall(1)
    Else
        GUICtrlSetState($btn_start, $GUI_DISABLE)
        LogThis("Odin awaits thy plan")
    EndIf

    While True

        $nMsg = GUIGetMsg(1)

        #Region Buttons
        ;main GUI
        If $nMsg[1] = $Odin_GUI Then

            #Region Ready phase
            If $p_ready Then

                If $nMsg[0] = $chk_main[0] Then SelectAll()
                For $c = 1 To 3
                    If $nMsg[0] = $chk_main[$c] Then CheckBoxes()
                Next

                If $nMsg[0] = $btn_1win_set Then GUIWinSet()
                If $nMsg[0] = $btn_2update Then GUIUpdate()
                ;               If $nMsg[0] = $btn_3programs Then GUIPrograms()

                If $nMsg[0] = $btn_start Then
                    StartInstall()
                EndIf

            EndIf
            #EndRegion Ready phase

            If $nMsg[0] = $btn_log Then ShowHideLog()

            If $nMsg[0] = $GUI_EVENT_CLOSE Then
                CleanUp()
                Exit
            EndIf

            ;child GUI
        ElseIf $nMsg[1] = $GUI_child Then

            If $p_R_winset Then SelectWinSet($nMsg[0])
            If $p_R_update Then SelectUpdates($nMsg[0])
            ;           If $p_R_programs Then SelectPrograms($nMsg[0])

            ;Log GUI
        ElseIf $nMsg[1] = $GUI_log Then

            If $nMsg[0] = $GUI_EVENT_CLOSE Then ShowHideLog()

        EndIf
        #EndRegion Buttons

        #Region Actual installation
        If $p_I_winset Then Do_WinSet()
        If $p_I_update Then Do_Updates($nMsg[0])
        ;       If $p_I_programs Then Do_Programs()
        #EndRegion Actual installation

        If Not $p_ready Then UpdateInstallData()
        Sleep(10)

    WEnd

EndFunc   ;==>MainLoop

 

update.au3

❤️

Link to comment
Share on other sites

Unfortunately cannot run the script as it's missing code, but having a loop within FindUpdates could be the cause of the issue, you may need to put error checks in place, to see where the error is occurring, but my guess would be the loop.  If a function is going to take a long time to complete, I'd place a SplashTextOn at the beginning of the function and update the SplashText, showing progress throughout the function and then SplashOff once it's completed.

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