sleepydvdr Posted May 13, 2010 Posted May 13, 2010 (edited) Hello all, I have a small working program and I created a function to produce an About box (called from the Main). However, when I click the red X, it exits the entire program instead of just the box. Here's the code for the About box: Func _About() Local $Form2, $Pic1, $Pic2, $i, $Label1, $Label2, $about FileInstall("src\website.jpg", @AppDataDir & "\MassiveRun\website.jpg", 1) $Form2 = GUICreate("About MassiveRun", 303, 128, -1, -1) $Pic2 = GUICtrlCreatePic(@AppDataDir & "\MassiveRun\website.jpg", 0, 110, 300, 15) GUICtrlSetCursor (-1, 0) $Pic1 = GUICtrlCreatePic(@AppDataDir & "\MassiveRun\FusionSolidSplash.jpg", 0, 0, 300, 110) $Label1 = GUICtrlCreateLabel("MassiveRun Software Installer", 30, 50, 150, 15) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) $Label2 = GUICtrlCreateLabel("Version 1.1", 30, 70, 100, 15) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUISetState(@SW_SHOW) $i = 0 While 1 Do $about = GUIGetMsg() Select Case $about = $GUI_EVENT_CLOSE exit Case $about = $Pic2 _IECreate("http://www.fusionsolid.com", 1) EndSelect until $i = 2 WEnd EndFunc I have been concentrating on the "Case $about = $GUI_EVENT_CLOSE" section. I have tried exiting the loop and closing the window and tried Exit 0, Exit 1, Exit 2, etc. Am I concentrating on the right part? Does anyone have any suggestions? Edited May 13, 2010 by sleepydvdr #include <ByteMe.au3>
taietel Posted May 13, 2010 Posted May 13, 2010 After GUISetState() replace the While...WEnd with Do $about = GUIGetMsg() If $about = $GUI_EVENT_CLOSE Then GUIDelete($Form2) Return EndIf If $about = $Pic2 Then _IECreate("http://www.fusionsolid.com", 1,1,0) EndIf Until $about = $GUI_EVENT_CLOSE Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text
sleepydvdr Posted May 13, 2010 Author Posted May 13, 2010 After GUISetState()replace the While...WEnd withThat worked perfectly. Thank you, taietel! #include <ByteMe.au3>
taietel Posted May 13, 2010 Posted May 13, 2010 No problem! That's what this forum is all about: to help each other and to share! Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text
Moderators SmOke_N Posted May 13, 2010 Moderators Posted May 13, 2010 I think switch statements work really nice with this type of loop:While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop ; Get out of the loop Case $Pic2 _IECreate("http://www.fusionsolid.com", 1) EndSwitch WEnd GUIDelete($Form2); Delete the GUI before we returnAlthough the concepts are similar. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
sleepydvdr Posted May 13, 2010 Author Posted May 13, 2010 Yes, that is another good way to solve it. The missing link for me was I didn't know about GUIDelete. On my previous efforts, I was trying to use WinClose. Thanks for the responses... #include <ByteMe.au3>
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