Sign in to follow this  
Followers 0

hide and restore help

3 posts in this topic

Posted (edited)

when i open the gui the hide button works fine, then when i click restore in the tray, it works fine. But then I try and press hide again to hide it or exit to exit out.... and it does nothing. What am I doing wrong?

Here is my code.

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $exitBtn
            Exit
        Case $hideBtn
            Hide()
        Case $startBtn
            Start()
    EndSwitch
WEnd

While 1
    $msg = GUIGetMsg()
    Select
                Case $msg = 0
                        ContinueLoop
        Case $msg = $restoreitem
            GUISetState(@SW_SHOW, $mainGUI)
        Case $msg = $hideitem
            GUISetState(@SW_HIDE, $mainGUI)
        Case $msg = $aboutitem
            Msgbox(64,"about:","created by Webber04")
        Case $msg = $exititem
            Exit
    EndSelect
WEnd

Func Hide()
    GUISetState(@SW_HIDE, $mainGUI)
    While 1
        Sleep(10)
    WEnd
    Exit
EndFunc

Func AboutClick()
    MsgBox(0, "About", "by Webber04")
EndFunc   ;==>AboutClicked

Func RestoreClick()
    GUISetState(@SW_SHOW, $mainGUI)
EndFunc   ;==>RestoreClicked

Func ExitEvent()
    Exit
EndFunc
Edited by vladedoty

Share this post


Link to post
Share on other sites



Posted

vladedoty,

The first thing I noticed was 2 GUIGetMsg() loops - why?

And then when I looked at your Hide function, I found this:

Func Hide()
    GUISetState(@SW_HIDE, $mainGUI)
    While 1
        Sleep(10)
    WEnd
    Exit
EndFunc

This function will never end as you set up an infinite loop with no possibility of exit.

So it is hardly surprising that your script has problems. Please post the full script - at the moment it is impossible to say what else might be causing you problems.

M23

Share this post


Link to post
Share on other sites

Posted

vladedoty,

The first thing I noticed was 2 GUIGetMsg() loops - why?

And then when I looked at your Hide function, I found this:

Func Hide()
    GUISetState(@SW_HIDE, $mainGUI)
    While 1
        Sleep(10)
    WEnd
    Exit
EndFunc

This function will never end as you set up an infinite loop with no possibility of exit.

So it is hardly surprising that your script has problems. Please post the full script - at the moment it is impossible to say what else might be causing you problems.

M23

nevermind i fixed it.

just added the l2 GUIMSG to the Start function.

and thx to your help, got rid of the while loop in the hide function.

Thx again

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  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.