nht3004 Posted June 15, 2009 Share Posted June 15, 2009 I create my tray Icon menu and so I need a loop to check when the menu is selected and as usual, I use "While". The problem is my program is around around my while loop and does not get out of that, so my program after While do not work, fix it for me, thanks $aboutTrayMenuItem=TrayCreateItem("About..."); $exitTrayMenuItem=TrayCreateItem("Thoát"); TraySetState(); While 1 $msgTrayMenuItem=TrayGetMsg(); Switch $msgTrayMenuItem; Case 0; ContinueLoop; Case $aboutTrayMenuItem; $aboutForm=GUICreate("Thông tin tác giả", 350, 160); GUISetBkColor(0xFFFFFF); $logo=GUICtrlCreatePic("about.jpg", 0, 0, 350, 160); GUISetState(@SW_SHOW); While 1 $msgAboutForm=GUIGetMsg(); Switch $msgAboutForm; Case $GUI_EVENT_CLOSE; GUIDelete($aboutForm); ExitLoop; EndSwitch WEnd Case $exitTrayMenuItem; Exit; EndSwitch WEnd ;This is my program code and the program would never run to here :( ( ....... for(loop=0; loop<infinity; loop++) { alert('I love you'); } Link to comment Share on other sites More sharing options...
GEOSoft Posted June 15, 2009 Share Posted June 15, 2009 I create my tray Icon menu and so I need a loop to check when the menu is selected and as usual, I use "While". The problem is my program is around around my while loop and does not get out of that, so my program after While do not work, fix it for me, thanks $aboutTrayMenuItem=TrayCreateItem("About..."); $exitTrayMenuItem=TrayCreateItem("Thoát"); TraySetState(); While 1 $msgTrayMenuItem=TrayGetMsg(); Switch $msgTrayMenuItem; Case 0; ContinueLoop; Case $aboutTrayMenuItem; $aboutForm=GUICreate("Thông tin tác giả", 350, 160); GUISetBkColor(0xFFFFFF); $logo=GUICtrlCreatePic("about.jpg", 0, 0, 350, 160); GUISetState(@SW_SHOW); While 1 $msgAboutForm=GUIGetMsg(); Switch $msgAboutForm; Case $GUI_EVENT_CLOSE; GUIDelete($aboutForm); ExitLoop; EndSwitch WEnd Case $exitTrayMenuItem; Exit; EndSwitch WEnd ;This is my program code and the program would never run to here :( ( .......Just on a hunch, you are also using GUI code. That means that the code you posted above has to be in the same loop as the GUI Msg. $aboutTrayMenuItem=TrayCreateItem("About..."); $exitTrayMenuItem=TrayCreateItem("Thoát"); TraySetState(); GUISetState While 1 $msgTrayMenuItem=TrayGetMsg(); $hMsg = GUIGetMsg() Switch $hMsg ;; GUI Case statements here EndSwitch Switch $msgTrayMenuItem; Case $aboutTrayMenuItem; $aboutForm=GUICreate("Thông tin tác gi?", 350, 160); GUISetBkColor(0xFFFFFF); $logo=GUICtrlCreatePic("about.jpg", 0, 0, 350, 160); GUISetState(@SW_SHOW); #cs Either put the about form in a separate function or take a look at GUISwitch() While 1 $msgAboutForm=GUIGetMsg(); Switch $msgAboutForm; Case $GUI_EVENT_CLOSE; GUIDelete($aboutForm); ExitLoop; EndSwitch WEnd #ce Case $exitTrayMenuItem, $GUI_EVENT_CLOSE; Exit; EndSwitch WEnd George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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