newbiescripter Posted February 24, 2008 Posted February 24, 2008 Hello when I try run the example and press the about button the About window pops up just like it should do, but when I then close it I only want that to be closed and not the main windows. How do I do that? I've tried the OnAutoItExit () but I can't make it work. Hope you can help me expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <ButtonConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Main Window", 217, 132, 406, 212) $MenuItem1 = GUICtrlCreateMenuItem("About",-1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MenuItem1 _About() EndSwitch WEnd Func _About() #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("About", 178, 166, 366, 246) GUISetIcon("D:\006.ico") $GroupBox1 = GUICtrlCreateGroup("", 8, 8, 161, 105) $Label1 = GUICtrlCreateLabel("Hello", 16, 32, 132, 68) GUICtrlSetFont(-1, 40, 400, 0, "MS Sans Serif") GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("&OK", 48, 128, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Exit EndSwitch WEnd EndFunc;==> _About() Thanks Regards
BigDod Posted February 24, 2008 Posted February 24, 2008 expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <ButtonConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Main Window", 217, 132, 406, 212) $MenuItem1 = GUICtrlCreateMenuItem("About",-1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MenuItem1 _About() EndSwitch WEnd Func _About() #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("About", 178, 166, 366, 246) GUISetIcon("D:\006.ico") $GroupBox1 = GUICtrlCreateGroup("", 8, 8, 161, 105) $Label1 = GUICtrlCreateLabel("Hello", 16, 32, 132, 68) GUICtrlSetFont(-1, 40, 400, 0, "MS Sans Serif") GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("&OK", 48, 128, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 GUIDelete($Form2) EndSwitch WEnd EndFunc;==> _About() Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
newbiescripter Posted February 24, 2008 Author Posted February 24, 2008 So simple Thanks.. Then I've another little question.. How do you put your code into this forum with colors? I can't I use the [Co de] and [/ Co de]
BigDod Posted February 24, 2008 Posted February 24, 2008 So simple Thanks.. Then I've another little question.. How do you put your code into this forum with colors? I can't I use the [Co de] and [/ Co de][ autoit ] [ /autoit ] without the spaces Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
Zedna Posted February 24, 2008 Posted February 24, 2008 Correction of BigDod's solution: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <ButtonConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Main Window", 217, 132, 406, 212) $MenuItem1 = GUICtrlCreateMenuItem("About", -1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MenuItem1 _About() EndSwitch WEnd Func _About() #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("About", 178, 166, 366, 246) GUISetIcon("D:\006.ico") $GroupBox1 = GUICtrlCreateGroup("", 8, 8, 161, 105) $Label1 = GUICtrlCreateLabel("Hello", 16, 32, 132, 68) GUICtrlSetFont(-1, 40, 400, 0, "MS Sans Serif") GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("&OK", 48, 128, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg(1) ; here are messages also from Form1 so you must distinguish them (here ignore them) Select Case ($nMsg[0] = $GUI_EVENT_CLOSE Or $nMsg[0] = $Button1) And $nMsg[1] = $Form2 GUIDelete($Form2) Return EndSelect WEnd EndFunc ;==>_About Resources UDF ResourcesEx UDF AutoIt Forum Search
BigDod Posted February 24, 2008 Posted February 24, 2008 Thanks I was in too much of a hurry Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
newbiescripter Posted February 24, 2008 Author Posted February 24, 2008 Thanks I now use it with return and thats works fine before the main window was useless until restart.
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