vladedoty Posted August 24, 2009 Share Posted August 24, 2009 (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. expandcollapse popupWhile 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 August 24, 2009 by vladedoty Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 24, 2009 Moderators Share Posted August 24, 2009 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 EndFuncThis 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 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
vladedoty Posted August 24, 2009 Author Share Posted August 24, 2009 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now