Sign in to follow this  
Followers 0
Warning

GUI problem

3 posts in this topic

I've made a little script. It cleans my computer. I've done with the most part of the program but a problem occured.

When I open 2 GUI and I press the 'X' button, it exits from the whole program. I've tried to mark the GUIs with unique datas.

Case $Menuitem13
$StateForm2 = 1
GUISetState(@SW_SHOW, $Form2)
$WindowOpened = 1

When another GUI appears the WindowOpened will be set to 1, and StateForm'X' will be set to 1.

So i've written this:

Case $GUI_EVENT_CLOSE
            
            msgbox(0,"", $WindowOpened & $StateForm2 & $StateForm3 & $StateForm4)
            
            If $StateForm2 = 1 Then
                GUISetState(@SW_HIDE, $Form2)
                $StateForm2 = 0
                $WindowOpened = 0
            EndIf
            
            If $StateForm3 = 1 Then
                GUISetState(@SW_HIDE, $Form3)
                $StateForm3 = 0
                $WindowOpened = 0
            EndIf
            
            If $StateForm4 = 1 Then
                GUISetState(@SW_HIDE, $Form4)
                $StateForm4 = 0
                $WindowOpened = 0
            EndIf
            
            If $WindowOpened = 0 Then
                exit 0
                        EndIf

It will use "exit 0" ONLY when the windowopened = 0.

BUT: If i press the 'X' button it exits from the whole program.

Where did I fail? I can't find the problem :)

The Most important part of the source:

#Region ### START Koda GUI section ### Form=form1.kxf
$Form1 = GUICreate("Win-Clean", 431, 291, 255, 145)
GUISetIcon(@ScriptDir & "/Data/cleaner.ico")
$Dummy1 = GUICtrlCreateDummy()
$Progress1 = GUICtrlCreateProgress(20,20,20,20)
GuiCtrlSetState($Progress1, $GUI_HIDE)
$Button2 = GUICtrlCreateButton("asd",40,40,40,40)
GuiCtrlSetState($Button2, $GUI_HIDE)
$PageControl1 = GUICtrlCreateTab(8, 8, 416, 256)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetState(-1, $GUI_CHECKED)

$MenuItem3 = GUICtrlCreateMenu("&Fájl")
$MenuItem6 = GUICtrlCreateMenuItem("Frissítés", $MenuItem3)
$MenuItem4 = GUICtrlCreateMenuItem("Kilépés", $MenuItem3)
$MenuItem2 = GUICtrlCreateMenu("&Eszközök")
$MenuItem7 = GUICtrlCreateMenuItem("Opciók", $MenuItem2)
$MenuItem8 = GUICtrlCreateMenuItem("1ClickOptimizer", $MenuItem2)
$MenuItem9 = GUICtrlCreateMenuItem("Gamer MediaPlayer", $MenuItem2)
$MenuItem10 = GUICtrlCreateMenuItem("CleanMgr", $MenuItem2)
$MenuItem11 = GUICtrlCreateMenuItem("Konzol", $MenuItem2)
$MenuItem1 = GUICtrlCreateMenu("&Segítség")
$MenuItem15 = GUICtrlCreateMenuItem("Verzió", $MenuItem1)
$MenuItem14 = GUICtrlCreateMenuItem("Készítők", $MenuItem1)
$MenuItem13 = GUICtrlCreateMenuItem("Használat", $MenuItem1)
$MenuItem12 = GUICtrlCreateMenuItem("Weboldal", $MenuItem1)

$TabSheet1 = GUICtrlCreateTabItem("Tisztítás")
$Checkbox1 = GUICtrlCreateCheckbox("Böngészők tisztítása", 32, 48, 129, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Checkbox2 = GUICtrlCreateCheckbox("Programok utáni tisztítás", 32, 72, 145, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Checkbox3 = GUICtrlCreateCheckbox("Windows Temp Fájljainak törlése", 32, 96, 177, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Checkbox4 = GUICtrlCreateCheckbox("Lomtár Kiürítése", 32, 120, 185, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Button1 = GUICtrlCreateButton("Tisztítás Futtatása", 32, 208, 105, 25, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Icon1 = GUICtrlCreateIcon(@ScriptDir & "/Data/Logo.ico", 0, 208, 48, 177, 196, BitOR($SS_NOTIFY,$WS_GROUP))
$Checkbox5 = GUICtrlCreateCheckbox("Egyedi helyek törlése", 32, 144, 137, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Checkbox15 = GUICtrlCreateCheckbox("Thumbs.db fájlok törlése (fölösleges)", 32, 168, 201, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")

GUICtrlCreateTabItem("Egyedi Sorok")
$Input1 = GUICtrlCreateInput($Input1, 16, 56, 289, 21)
$Input2 = GUICtrlCreateInput($Input2, 16, 96, 289, 21)
$Input3 = GUICtrlCreateInput($Input3, 16, 136, 289, 21)
$Input4 = GUICtrlCreateInput($Input4, 16, 176, 289, 21)
$Input5 = GUICtrlCreateInput($Input5, 16, 216, 289, 21)
$Button9 = GUICtrlCreateButton("Tallózás", 320, 56, 73, 21, 0)
$Button10 = GUICtrlCreateButton("Tallózás", 320, 96, 73, 21, 0)
$Button11 = GUICtrlCreateButton("Tallózás", 320, 136, 73, 21, 0)
$Button12 = GUICtrlCreateButton("Tallózás", 320, 176, 73, 21, 0)
$Button13 = GUICtrlCreateButton("Tallózás", 320, 216, 73, 21, 0)

$TabSheet5 = GUICtrlCreateTabItem("Extrák")
$Button3 = GUICtrlCreateButton("ZureD MediaPlay3R", 24, 40, 169, 25, 0)
$Progress2 = GUICtrlCreateProgress(24, 232, 369, 17)
$Button5 = GUICtrlCreateButton("Win-Clean 1 kattintásos tisztító", 24, 80, 169, 25, 0)
$Label20 = GUICtrlCreateLabel("Zene és Videó- lejátszó prgram", 216, 40, 149, 17)
$Label21 = GUICtrlCreateLabel("Ugyan az mint a Win-Clean csak kezdő", 208, 80, 190, 17)
$Label23 = GUICtrlCreateLabel("felhasználók számára. Egy kattintással", 208, 96, 185, 17)
$Label24 = GUICtrlCreateLabel("minden törlést elvégez [nincsenek beállítási lehetőségek]", 128, 112, 272, 17)

$TabSheet4 = GUICtrlCreateTabItem("Beállítások")
$Label16 = GUICtrlCreateLabel("Válaszd ki, hogy milyen programok vannak", 16, 40, 202, 17)
GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
$Label17 = GUICtrlCreateLabel("Feltelepítve a számítógépedre!", 16, 56, 149, 17)
GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
$Checkbox6 = GUICtrlCreateCheckbox("Internet Explorer", 16, 88, 145, 17)
$Checkbox7 = GUICtrlCreateCheckbox("Google Chrome", 16, 104, 145, 17)
$Checkbox8 = GUICtrlCreateCheckbox("Mozzila Firefox", 16, 120, 129, 17)
$Checkbox9 = GUICtrlCreateCheckbox("Avant Browser", 16, 136, 129, 17)
$Checkbox10 = GUICtrlCreateCheckbox("Opera Browser", 16, 152, 121, 17)
$Checkbox11 = GUICtrlCreateCheckbox("MSN messenger", 16, 184, 113, 17)
$Checkbox12 = GUICtrlCreateCheckbox("Spybot Search and Destroy", 16, 200, 153, 17)
$Checkbox13 = GUICtrlCreateCheckbox("Punkbuster [PB]", 16, 216, 105, 17)
$Checkbox14 = GUICtrlCreateCheckbox("Macromedia Flash Player", 16, 232, 145, 17)
$Label18 = GUICtrlCreateLabel("Programok:", 16, 168, 58, 17)
$Label19 = GUICtrlCreateLabel("Böngészők:", 16, 72, 60, 17)
$Button6 = GUICtrlCreateButton("!!! Beállítások mentése !!!", 200, 232, 193, 25, 0)

$TabSheet3 = GUICtrlCreateTabItem("About")
$Label5 = GUICtrlCreateLabel("", 8, 40, 4, 4)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Label6 = GUICtrlCreateLabel("Win-Cleaner v" & $CurrentVersion, 120, 40, 142, 27)
GUICtrlSetFont(-1, 12, 800, 4, "comic sans ms")
$Label7 = GUICtrlCreateLabel("Készítette: Unc3nZureD", 120, 64, 133, 19)
GUICtrlSetFont(-1, 9, 400, 0, "arial")
$Label8 = GUICtrlCreateLabel("> Külön köszönet:", 128, 88, 101, 19)
GUICtrlSetFont(-1, 9, 400, 0, "arial")
$Label9 = GUICtrlCreateLabel("Jos", 232, 104, 24, 19)
GUICtrlSetFont(-1, 9, 400, 0, "arial")
$Label10 = GUICtrlCreateLabel("iamtheky", 232, 120, 53, 19)
GUICtrlSetFont(-1, 9, 400, 0, "arial")
$Label11 = GUICtrlCreateLabel("Elérhetőségeim:", 120, 152, 95, 19)
GUICtrlSetFont(-1, 9, 400, 4, "arial")
$Label12 = GUICtrlCreateLabel("Xfire: Unc3nZureD", 136, 176, 104, 19)
GUICtrlSetFont(-1, 9, 400, 0, "arial")
$Label13 = GUICtrlCreateLabel("E-mail:", 136, 192, 43, 19)
GUICtrlSetFont(-1, 9, 400, 0, "arial")
$Label14 = GUICtrlCreateLabel("Rol4nd@Freemail.hu", 184, 192, 122, 19)
GUICtrlSetFont(-1, 9, 400, 0, "arial")
$Label15 = GUICtrlCreateLabel("Spirit", 232, 88, 32, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label22 = GUICtrlCreateLabel('"Yes, I will see u, Through the Smokin' & "'" & ' Flames - on the Frontlines of War"', 13, 240, 400, 18)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")

$Form2 = GUICreate("Help", 361, 433, 285, 150)
$Label1 = GUICtrlCreateLabel("A program használata", 8, 152, 155, 20)
GUICtrlSetFont(-1, 10, 800, 4, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Leírás", 8, 8, 47, 20)
GUICtrlSetFont(-1, 10, 800, 4, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("A programmal az internetről letöltött ideiglenes fájlokat tudod törölni.", 8, 32, 319, 17)
$Label4 = GUICtrlCreateLabel("Minden egyes weboldal megnyitásakor a böngésző akarva/akaratanul", 8, 48, 335, 17)
$Label5 = GUICtrlCreateLabel("letölti azokat a fájlokat amik szükségesek az oldal megnyitásakor.", 8, 64, 312, 17)
$Label6 = GUICtrlCreateLabel("Ezeket a fájlokat a böngésző nem törli le az oldal elhagyása után mert", 8, 80, 331, 17)
$Label7 = GUICtrlCreateLabel("még később hasznosak lehetnek ha ugyan azt az oldalt akarod behozni", 8, 96, 342, 17)
$Label8 = GUICtrlCreateLabel("akkor nem kell letöltse mégegyszer. Ha viszont nem akarjuk gyakran", 8, 112, 326, 17)
$Label9 = GUICtrlCreateLabel("látogatni ugyan azt a weboldalt akkor ajánlott használni ezt a programot", 8, 128, 340, 17)
$Label10 = GUICtrlCreateLabel("Ahhoz hogy el tudjuk kezdeni a tisztítást először be kell állítani a", 8, 176, 305, 17)
$Label11 = GUICtrlCreateLabel("főmenüben hogy milyen programok után tisztítson. Ezt a lehetőséget", 8, 192, 324, 17)
$Label12 = GUICtrlCreateLabel("a főmenüben a 'Beállítások' menüpontban találhatod meg.", 8, 208, 277, 17)
$Label13 = GUICtrlCreateLabel("Az Eszközök/Opciók részlegen a következő dolgokat lehet beállítani:", 8, 240, 332, 17)
$Label14 = GUICtrlCreateLabel("Automatikus indítás a windows-al (szerintem ide nem kell magyarázat)", 24, 256, 329, 17)
$Label15 = GUICtrlCreateLabel("Frissítések automatikus keresése -> A program indításakor azonnal", 24, 272, 318, 17)
$Label16 = GUICtrlCreateLabel("megkeresi és felajánlja az újabb", 192, 288, 153, 17)
$Label17 = GUICtrlCreateLabel("verzió letöltését", 192, 304, 77, 17)
$Label18 = GUICtrlCreateLabel("Console Engedélyezése -> Ha nem tudod hogy mit jelent akkor az azt", 24, 320, 330, 17)
$Label19 = GUICtrlCreateLabel("jelenti hogy számodra NEM fontos.", 152, 336, 167, 17)
$Label20 = GUICtrlCreateLabel("Ez a teszteléskor fontos.", 152, 352, 119, 17)
$Label21 = GUICtrlCreateLabel("Frissítési szerver -> Innen tölti le a legújabb verziót", 24, 376, 239, 17)
$Label22 = GUICtrlCreateLabel("Minden lejenlegi beállítás törlése -> Törli az ÖSSZES beállítást", 24, 400, 296, 17)
GUISetState(@SW_HIDE, $Form2)

$Form3 = GUICreate("Beta Console Program", 287, 303, 306, 204)
$Label1 = GUICtrlCreateLabel("AutoIT / RunDos - Dos Console", 8, 8, 221, 20)
GUICtrlSetFont(-1, 10, 800, 4, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Ez a funkció főleg a tesztelésben hasznos, ezért ha", 8, 32, 246, 17)
$Label3 = GUICtrlCreateLabel("nem vagy tesztelő akkor nem ajánlatos használni.", 8, 48, 237, 17)
$Label4 = GUICtrlCreateLabel("Ezzel akár ki is törölhetsz fontos adatokat a", 8, 64, 208, 17)
$Label5 = GUICtrlCreateLabel("számítógépedről, vagy akár a program lefagyásához", 8, 80, 249, 17)
$Label6 = GUICtrlCreateLabel("is vezethet!", 8, 96, 58, 17)
$Label7 = GUICtrlCreateLabel("_______________________________________________", 0, 112, 286, 17)
$Label8 = GUICtrlCreateLabel("AutoIT x32 v3 stabile InstantCommand", 8, 136, 186, 17)
$Input6 = GUICtrlCreateInput("Command", 8, 152, 209, 21)
$Button33 = GUICtrlCreateButton("Send", 232, 152, 49, 21, 0)
$Label10 = GUICtrlCreateLabel("Instant Dos command with PAUSE [BatchWriter func]", 8, 192, 257, 17)
$Input7 = GUICtrlCreateInput("Command", 8, 208, 209, 21)
$Button34 = GUICtrlCreateButton("Send", 232, 208, 49, 21, 0)
$Label9 = GUICtrlCreateLabel("Test Del Ability", 8, 248, 74, 17)
$Input8 = GUICtrlCreateInput("del /f /s /q ", 8, 264, 209, 21)
$Button35 = GUICtrlCreateButton("Send", 232, 264, 49, 21, 0)
GUISetState(@SW_HIDE, $Form3)

$Form4 = GUICreate("Opciók", 246, 291, 398, 194)
$Checkbox21 = GUICtrlCreateCheckbox("Automatikus indulás a windwos-al", 16, 40, 185, 17)
$Label1 = GUICtrlCreateLabel("Beállítások", 16, 8, 86, 24)
GUICtrlSetFont(-1, 12, 400, 4, "MS Sans Serif")
$Checkbox22 = GUICtrlCreateCheckbox("Frissítések automatikus keresése", 16, 64, 177, 17)
$Button37 = GUICtrlCreateButton("Minden jelenlegi beállítás törlése", 16, 200, 193, 25, 0)
$Checkbox23 = GUICtrlCreateCheckbox("'Console' Engedélyezése (Tesztelőknek)", 16, 88, 217, 17)
$Label2 = GUICtrlCreateLabel("Frissítési szerver:", 24, 112, 84, 17)
$Input10 = GUICtrlCreateInput("http://www.winclean.yolasite.com/resources/Server.ini", 16, 136, 193, 21)
$Input11 = GUICtrlCreateInput("http://winclean.uw.hu/Win_Clean.zip", 16, 168, 193, 21)
$Button35 = GUICtrlCreateButton("Mentés", 16, 248, 89, 25, 0)
$Button36 = GUICtrlCreateButton("Mégsem", 128, 248, 81, 25, 0)
GUISetState(@SW_HIDE, $Form3)

GUICtrlCreateTabItem("")
$Button6context = GUICtrlCreateContextMenu($Button6)
GUISetState(@SW_SHOW, $Form1)
#EndRegion ### END Koda GUI section ###

GUICtrlSetState($Checkbox15, $GUI_HIDE)

If $Settings = "" Then
    GuiCtrlSetState($Button1, $GUI_HIDE)
EndIf

While 1
$nMsg = GUIGetMsg()
        Switch $nMsg
        Case $GUI_EVENT_CLOSE
            
            msgbox(0,"", $WindowOpened & $StateForm2 & $StateForm3 & $StateForm4)
            
            If $StateForm2 = 1 Then
                GUISetState(@SW_HIDE, $Form2)
                $StateForm2 = 0
                $WindowOpened = 0
            EndIf
            
            If $StateForm3 = 1 Then
                GUISetState(@SW_HIDE, $Form3)
                $StateForm3 = 0
                $WindowOpened = 0
            EndIf
            
            If $StateForm4 = 1 Then
                GUISetState(@SW_HIDE, $Form4)
                $StateForm4 = 0
                $WindowOpened = 0
            EndIf
            
            If $WindowOpened = 0 Then
                exit 0
            EndIf
        Case $MenuItem4
            exit 0
        Case $Menuitem10
            Run("Cleanmgr.exe")
        Case $Menuitem7
            $StateForm4 = 1
            GUISetState(@SW_SHOW, $Form4)
            $WindowOpened = 1
        Case $Menuitem11
            $StateForm3 = 1
            GUISetState(@SW_SHOW, $Form3)
            $WindowOpened = 1

Share this post


Link to post
Share on other sites



I would suggest looking at the Wiki Entry about "Multiple GUI's" >> http://www.autoitscript.com/wiki/Managing_Multiple_GUIs because this will help you with GUIGetMsg() and the advanced parameter.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

ohh, nice - exactly my problem :)

Thanks, I'm reading!

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