Jump to content

Assistance with getting a child window to close


Caer12
 Share

Recommended Posts

I've tried as many ways as I could, and I just can't seem to get it right. Under the functions of the button, a child gui is created, and I need the gui to close when someone hits the x button, but not the parent gui.

#include <GUIConstants.au3>
#include <INet.au3>
#include <String.au3>
#include <array.au3>



;~~~~~~~~~~~~~~~~~~~~SERVER STATUS AND PLAYERS ONLINE~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

;ADLIB
AdlibEnable("SetPlayers", 5000)
AdlibEnable("Setstatus", 1200000)

;SERVER STATUS
$widthCell = 36
GUICtrlSetColor(-1, 0xff00)

;SEARCH FOR TEXT AND POSTS CASE
Dim $avCodes[1] = ["GIF89"]
$src1 = _INetGetSource('http://www.qonquer.com/status/status.php?link=127.0.0.1:9958')
$trm1 = StringTrimLeft($src1, 0)
$trm3 = StringTrimRight($trm1, 49)
For $i = 0 To UBound($avCodes) - 1
    $Input = $avCodes[$i]
    $Pos = _ArraySearch($trm3, $Input)
    Select
        Case $Pos = -1
            GUICtrlCreatePic("online.bmp", 12, 38, 36, 18)
        Case Else
            GUICtrlCreatePic("offline.bmp", -1, 0, 36, 18)
    EndSelect
Next

;PLAYERS ONLINE
$label = GUICtrlCreateLabel(Getplayers(), -1, 33, $widthCell)

GUISetState()


;REFRESH PLAYERS
Func Getplayers()
    $src = _INetGetSource('http://69.41.179.98:9980/online.js')
    $trm = StringTrimLeft($src, 17)
    $trm2 = StringTrimRight($trm, 4)
    Return $trm2
EndFunc  ;==>Getplayers


Func SetPlayers ()
    GUICtrlSetData($label, Getplayers())
EndFunc  ;==>SetPlayers

;REFRESH SERVER STATUS
Func Getstatus()
    Dim $avCodes[1] = ["GIF89"]
$src1 = _INetGetSource('http://www.qonquer.com/status/status.php?link=127.0.0.1:9958')
$trm1 = StringTrimLeft($src1, 0)
$trm3 = StringTrimRight($trm1, 49)
For $i = 0 To UBound($avCodes) - 1
    $Input = $avCodes[$i]
    $Pos = _ArraySearch($trm3, $Input)
    Select
        Case $Pos = -1
            GUICtrlCreatePic("online.bmp", 12, 38, 36, 18)
        Case Else
            GUICtrlCreatePic("offline.bmp", -1, 0, 36, 18)
    EndSelect
Next
    Return $Pos
EndFunc  ;==>Getstatus


Func Setstatus ()
    GUICtrlSetData($Pos, Getstatus())
EndFunc  ;==>SetPlayers




;~~~~~~~~~~~~~~~~~~~~~~~~~~~~BUTTONS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Opt("GUIOnEventMode",1)

$ParentWin  = GUICreate("Qonquer Helper", 325, 400)


$Connect  = GUICtrlCreateButton("Connecting to Qonquer", 5, 300, 150, 20)
GUICtrlSetOnEvent($Connect,"Connect")

$CreateAcc   = GUICtrlCreateButton("Creating an Account", 5, 325, 150, 20)
GUICtrlSetOnEvent($CreateAcc,"CreateAcc")

$CantCon   = GUICtrlCreateButton("Can't Connect?!", 5, 350, 150, 20)
GUICtrlSetOnEvent($CantCon,"CantCon")

$Ban   = GUICtrlCreateButton("About Bans", 5, 375, 150, 20)
GUICtrlSetOnEvent($Ban,"Ban")

$Features   = GUICtrlCreateButton("About New Features", 170, 300, 150, 20)
GUICtrlSetOnEvent($Features,"Features")

$Items   = GUICtrlCreateButton("About New Items", 170, 325, 150, 20)
GUICtrlSetOnEvent($Items,"Items")

$QueEvents   = GUICtrlCreateButton("About Quests/Events", 170, 350, 150, 20)
GUICtrlSetOnEvent($QueEvents,"QueEvents")

$Forum   = GUICtrlCreateButton("Forum Info/Rules", 170, 375, 150, 20)
GUICtrlSetOnEvent($Forum,"Forum")


GUISetOnEvent($GUI_EVENT_CLOSE,"ExitW")
GUISetIcon("tqzf.ico")

GUISetState()


;BACKGROUND IMAGE
$background  = GUICtrlCreatePic("qbackground.bmp", 0, 0, 325, 400)
GuiCtrlSetState(-1,$GUI_DISABLE)

While 1
   Sleep (1000)   
WEnd







;--------------- Functions ---------------

Func Connect()
    $ChildWin  = GUICreate("Connecting to Qonquer", 325, 400, 100, 100, -1, -1, $ParentWin)
    GUISetState(@SW_SHOW)
    GUISetIcon("tqzf.ico")
    ;Content
    $L1 = GUICtrlCreateLabel("The best way to connect is by using Lakshya's custom Qonquer client:", 5, 5, 320, 28,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $E1 = GUICtrlCreateEdit("http://www.megaupload.com/?d=MPGN1J45", 5, 40, 310, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $L2 = GUICtrlCreateLabel("You'll need Winrar to extract the folder", 5, 65, 320, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $E2 = GUICtrlCreateEdit("http://www.win-rar.com/", 5, 87, 310, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $L3 = GUICtrlCreateLabel("Installing the client is self explanatory, extract it in your program files folder. However, if you would like more assistance:", 5, 115, 320, 30,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $E3 = GUICtrlCreateEdit("http://www.qonquer.com/forum/viewtopic.php?t=14963", 5, 149, 310, 25,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $conpic1  = GUICtrlCreatePic("qonquercon.bmp", 0, 200, 400, 200)
    

EndFunc

Func CreateAcc()
    $ChildWin  = GUICreate("Creating an Account", 325, 400, 100, 100, -1, -1, $ParentWin)
    GUISetState(@SW_SHOW)
    GUISetIcon("tqzf.ico")
    ;Content
    $L1 = GUICtrlCreateLabel("1. Go to the Qonquer Online site", 5, 5, 320, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $E1 = GUICtrlCreateEdit("http://www.qonquer.com/forum/portal.php", 5, 25, 310, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $L2 = GUICtrlCreateLabel("2. Click on ACCOUNT on the navigation", 5, 50, 320, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $crnpic1  = GUICtrlCreatePic("Accountnav.bmp", 0, 70, 325, 52)
    $L3 = GUICtrlCreateLabel("Or use this link:", 5, 130, 320, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $E2 = GUICtrlCreateEdit("http://www.qonquer.com/forum/portal.php?page=6", 5, 155, 310, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $L4 = GUICtrlCreateLabel("3. Click on NEW ACCOUNT", 5, 180, 320, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $crnpic2  = GUICtrlCreatePic("creacc.bmp", 0, 200, 325, 116)
    $L5 = GUICtrlCreateLabel("4. Fill out all of the Information", 5, 321, 320, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
EndFunc

Func CantCon()
    $ChildWin  = GUICreate("Can't Connect?!", 325, 400, 100, 100, -1, -1, $ParentWin)
    GUISetState(@SW_SHOW)
    GUISetIcon("tqzf.ico")
    ;Content
    $L1 = GUICtrlCreateLabel("If you cannot connect, either the connection from your client is faulty, the server is down or frozen, you're banned, or you're using the incorrect username or password.", 5, 5, 320, 40,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $L2 = GUICtrlCreateLabel("You can find out if the server is offline, or you're ip banned by going here:", 5, 60, 320, 28,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $E1 = GUICtrlCreateEdit("http://www.qonquer.com/forum/portal.php", 5, 90, 310, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $L3 = GUICtrlCreateLabel("1. If the server is online but you can't see a number of players, you're IP banned", 5, 115, 320, 30,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $L4 = GUICtrlCreateLabel("2. If the server status icon is a frowny face, it is off-line", 5, 155, 320, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $cantpic1  = GUICtrlCreatePic("serverstatus5ae.bmp", 0, 180, 157, 78)
    $L5 = GUICtrlCreateLabel("3. Make sure you're connecting to the correct IP Address:", 5, 265, 320, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $E1 = GUICtrlCreateEdit("69.41.179.99", 5, 290, 310, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $L6 = GUICtrlCreateLabel("4. Make sure you are using the correct username and password for connecting to Qonquer, remember that Qonquer and Conquer Online are not the same.", 5, 315, 320, 50,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
EndFunc

Func Ban()
    $ChildWin  = GUICreate("About Bans", 325, 400, 100, 100, -1, -1, $ParentWin)
    GUISetState(@SW_SHOW)
    GUISetIcon("tqzf.ico")
    ;Content
    $L1 = GUICtrlCreateLabel("There are 2 kinds of bans; account bans and IP bans.", 5, 5, 320, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $L2 = GUICtrlCreateLabel("1. Account bans happen when you have done something wrong, like botting etc. Account bans can last forever, or until the next server restart. Most account bans usually come with IP bans.", 5, 30, 320, 80,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $L3 = GUICtrlCreateLabel("2. IP bans can happen for a number of reasons, logging in too many times, being banned for 'supposedly' auto-hunting, or doing something bad/wrong. If this happens to you, you'll have to wait until the next server restart to log back in. You will not be able to see the number of players online on the homepage.", 5, 100, 320, 80,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $banpic1  = GUICtrlCreatePic("ipban.bmp", 0, 180, 202, 157)
    $L4 = GUICtrlCreateLabel("THE BEST WAY TO AVOID THIS IS BY NOT GETTING INTO TROUBLE!", 5, 355, 320, 30,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    
EndFunc

Func Features()
    $ChildWin  = GUICreate("About New Features", 325, 400, 100, 100, -1, -1, $ParentWin)
    GUISetState(@SW_SHOW)
    GUISetIcon("tqzf.ico")
EndFunc

Func Items()
    $ChildWin  = GUICreate("About New Items", 325, 400, 100, 100, -1, -1, $ParentWin)
    GUISetState(@SW_SHOW)
    GUISetIcon("tqzf.ico")
EndFunc

Func QueEvents()
    $ChildWin  = GUICreate("About NPC's", 325, 400, 100, 100, -1, -1, $ParentWin)
    GUISetState(@SW_SHOW)
    GUISetIcon("tqzf.ico")
EndFunc

Func Forum()
    $ChildWin  = GUICreate("Forum Info/Rules", 325, 400, 100, 100, -1, -1, $ParentWin)
    GUISetState(@SW_SHOW)
    GUISetIcon("tqzf.ico")
EndFunc

Func ExitW()
    Exit
EndFunc

Any help is greatly appreciated, or if someone could point me in the right direction.

Link to comment
Share on other sites

Well you are using your script onEventMode. So you are gonna have to specify a handle for GUISetOnEvent() every time you create a child. Like this:

(I only did it with the first one (Connect))

#include <GUIConstants.au3>
#include <INet.au3>
#include <String.au3>
#include <array.au3>



;~~~~~~~~~~~~~~~~~~~~SERVER STATUS AND PLAYERS ONLINE~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

;ADLIB
AdlibEnable("SetPlayers", 5000)
AdlibEnable("Setstatus", 1200000)

;SERVER STATUS
$widthCell = 36
GUICtrlSetColor(-1, 0xff00)

;SEARCH FOR TEXT AND POSTS CASE
Dim $avCodes[1] = ["GIF89"]
$src1 = _INetGetSource('http://www.qonquer.com/status/status.php?link=127.0.0.1:9958')
$trm1 = StringTrimLeft($src1, 0)
$trm3 = StringTrimRight($trm1, 49)
For $i = 0 To UBound($avCodes) - 1
    $Input = $avCodes[$i]
    $Pos = _ArraySearch($trm3, $Input)
    Select
        Case $Pos = -1
            GUICtrlCreatePic("online.bmp", 12, 38, 36, 18)
        Case Else
            GUICtrlCreatePic("offline.bmp", -1, 0, 36, 18)
    EndSelect
Next

;PLAYERS ONLINE
$label = GUICtrlCreateLabel(Getplayers(), -1, 33, $widthCell)

GUISetState()


;REFRESH PLAYERS
Func Getplayers()
    $src = _INetGetSource('http://69.41.179.98:9980/online.js')
    $trm = StringTrimLeft($src, 17)
    $trm2 = StringTrimRight($trm, 4)
    Return $trm2
EndFunc  ;==>Getplayers


Func SetPlayers ()
    GUICtrlSetData($label, Getplayers())
EndFunc  ;==>SetPlayers

;REFRESH SERVER STATUS
Func Getstatus()
    Dim $avCodes[1] = ["GIF89"]
$src1 = _INetGetSource('http://www.qonquer.com/status/status.php?link=127.0.0.1:9958')
$trm1 = StringTrimLeft($src1, 0)
$trm3 = StringTrimRight($trm1, 49)
For $i = 0 To UBound($avCodes) - 1
    $Input = $avCodes[$i]
    $Pos = _ArraySearch($trm3, $Input)
    Select
        Case $Pos = -1
            GUICtrlCreatePic("online.bmp", 12, 38, 36, 18)
        Case Else
            GUICtrlCreatePic("offline.bmp", -1, 0, 36, 18)
    EndSelect
Next
    Return $Pos
EndFunc  ;==>Getstatus


Func Setstatus ()
    GUICtrlSetData($Pos, Getstatus())
EndFunc  ;==>SetPlayers




;~~~~~~~~~~~~~~~~~~~~~~~~~~~~BUTTONS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Opt("GUIOnEventMode",1)

$ParentWin  = GUICreate("Qonquer Helper", 325, 400)


$Connect  = GUICtrlCreateButton("Connecting to Qonquer", 5, 300, 150, 20)
GUICtrlSetOnEvent($Connect,"Connect")

$CreateAcc   = GUICtrlCreateButton("Creating an Account", 5, 325, 150, 20)
GUICtrlSetOnEvent($CreateAcc,"CreateAcc")

$CantCon   = GUICtrlCreateButton("Can't Connect?!", 5, 350, 150, 20)
GUICtrlSetOnEvent($CantCon,"CantCon")

$Ban   = GUICtrlCreateButton("About Bans", 5, 375, 150, 20)
GUICtrlSetOnEvent($Ban,"Ban")

$Features   = GUICtrlCreateButton("About New Features", 170, 300, 150, 20)
GUICtrlSetOnEvent($Features,"Features")

$Items   = GUICtrlCreateButton("About New Items", 170, 325, 150, 20)
GUICtrlSetOnEvent($Items,"Items")

$QueEvents   = GUICtrlCreateButton("About Quests/Events", 170, 350, 150, 20)
GUICtrlSetOnEvent($QueEvents,"QueEvents")

$Forum   = GUICtrlCreateButton("Forum Info/Rules", 170, 375, 150, 20)
GUICtrlSetOnEvent($Forum,"Forum")


GUISetOnEvent($GUI_EVENT_CLOSE,"ExitW")
GUISetIcon("tqzf.ico")

GUISetState()


;BACKGROUND IMAGE
$background  = GUICtrlCreatePic("qbackground.bmp", 0, 0, 325, 400)
GuiCtrlSetState(-1,$GUI_DISABLE)

While 1
   Sleep (1000)   
WEnd







;--------------- Functions ---------------

Func Connect()
    $ChildWin  = GUICreate("Connecting to Qonquer", 325, 400, 100, 100, -1, -1, $ParentWin)
    GUISetOnEvent ( $GUI_EVENT_CLOSE, "DeleteGui",$ChildWin)

    GUISetState(@SW_SHOW)
    GUISetIcon("tqzf.ico")
    ;Content
    $L1 = GUICtrlCreateLabel("The best way to connect is by using Lakshya's custom Qonquer client:", 5, 5, 320, 28,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $E1 = GUICtrlCreateEdit("http://www.megaupload.com/?d=MPGN1J45", 5, 40, 310, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $L2 = GUICtrlCreateLabel("You'll need Winrar to extract the folder", 5, 65, 320, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $E2 = GUICtrlCreateEdit("http://www.win-rar.com/", 5, 87, 310, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $L3 = GUICtrlCreateLabel("Installing the client is self explanatory, extract it in your program files folder. However, if you would like more assistance:", 5, 115, 320, 30,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $E3 = GUICtrlCreateEdit("http://www.qonquer.com/forum/viewtopic.php?t=14963", 5, 149, 310, 25,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $conpic1  = GUICtrlCreatePic("qonquercon.bmp", 0, 200, 400, 200)
    

EndFunc

Func CreateAcc()
    $ChildWin  = GUICreate("Creating an Account", 325, 400, 100, 100, -1, -1, $ParentWin)
    GUISetState(@SW_SHOW)
    GUISetIcon("tqzf.ico")
    ;Content
    $L1 = GUICtrlCreateLabel("1. Go to the Qonquer Online site", 5, 5, 320, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $E1 = GUICtrlCreateEdit("http://www.qonquer.com/forum/portal.php", 5, 25, 310, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $L2 = GUICtrlCreateLabel("2. Click on ACCOUNT on the navigation", 5, 50, 320, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $crnpic1  = GUICtrlCreatePic("Accountnav.bmp", 0, 70, 325, 52)
    $L3 = GUICtrlCreateLabel("Or use this link:", 5, 130, 320, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $E2 = GUICtrlCreateEdit("http://www.qonquer.com/forum/portal.php?page=6", 5, 155, 310, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $L4 = GUICtrlCreateLabel("3. Click on NEW ACCOUNT", 5, 180, 320, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $crnpic2  = GUICtrlCreatePic("creacc.bmp", 0, 200, 325, 116)
    $L5 = GUICtrlCreateLabel("4. Fill out all of the Information", 5, 321, 320, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
EndFunc

Func CantCon()
    $ChildWin  = GUICreate("Can't Connect?!", 325, 400, 100, 100, -1, -1, $ParentWin)
    GUISetState(@SW_SHOW)
    GUISetIcon("tqzf.ico")
    ;Content
    $L1 = GUICtrlCreateLabel("If you cannot connect, either the connection from your client is faulty, the server is down or frozen, you're banned, or you're using the incorrect username or password.", 5, 5, 320, 40,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $L2 = GUICtrlCreateLabel("You can find out if the server is offline, or you're ip banned by going here:", 5, 60, 320, 28,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $E1 = GUICtrlCreateEdit("http://www.qonquer.com/forum/portal.php", 5, 90, 310, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $L3 = GUICtrlCreateLabel("1. If the server is online but you can't see a number of players, you're IP banned", 5, 115, 320, 30,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $L4 = GUICtrlCreateLabel("2. If the server status icon is a frowny face, it is off-line", 5, 155, 320, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $cantpic1  = GUICtrlCreatePic("serverstatus5ae.bmp", 0, 180, 157, 78)
    $L5 = GUICtrlCreateLabel("3. Make sure you're connecting to the correct IP Address:", 5, 265, 320, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $E1 = GUICtrlCreateEdit("69.41.179.99", 5, 290, 310, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $L6 = GUICtrlCreateLabel("4. Make sure you are using the correct username and password for connecting to Qonquer, remember that Qonquer and Conquer Online are not the same.", 5, 315, 320, 50,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
EndFunc

Func Ban()
    $ChildWin  = GUICreate("About Bans", 325, 400, 100, 100, -1, -1, $ParentWin)
    GUISetState(@SW_SHOW)
    GUISetIcon("tqzf.ico")
    ;Content
    $L1 = GUICtrlCreateLabel("There are 2 kinds of bans; account bans and IP bans.", 5, 5, 320, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $L2 = GUICtrlCreateLabel("1. Account bans happen when you have done something wrong, like botting etc. Account bans can last forever, or until the next server restart. Most account bans usually come with IP bans.", 5, 30, 320, 80,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $L3 = GUICtrlCreateLabel("2. IP bans can happen for a number of reasons, logging in too many times, being banned for 'supposedly' auto-hunting, or doing something bad/wrong. If this happens to you, you'll have to wait until the next server restart to log back in. You will not be able to see the number of players online on the homepage.", 5, 100, 320, 80,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $banpic1  = GUICtrlCreatePic("ipban.bmp", 0, 180, 202, 157)
    $L4 = GUICtrlCreateLabel("THE BEST WAY TO AVOID THIS IS BY NOT GETTING INTO TROUBLE!", 5, 355, 320, 30,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    
EndFunc

Func Features()
    $ChildWin  = GUICreate("About New Features", 325, 400, 100, 100, -1, -1, $ParentWin)
    GUISetState(@SW_SHOW)
    GUISetIcon("tqzf.ico")
EndFunc

Func Items()
    $ChildWin  = GUICreate("About New Items", 325, 400, 100, 100, -1, -1, $ParentWin)
    GUISetState(@SW_SHOW)
    GUISetIcon("tqzf.ico")
EndFunc

Func QueEvents()
    $ChildWin  = GUICreate("About NPC's", 325, 400, 100, 100, -1, -1, $ParentWin)
    GUISetState(@SW_SHOW)
    GUISetIcon("tqzf.ico")
EndFunc

Func Forum()
    $ChildWin  = GUICreate("Forum Info/Rules", 325, 400, 100, 100, -1, -1, $ParentWin)
    GUISetState(@SW_SHOW)
    GUISetIcon("tqzf.ico")
EndFunc

Func ExitW()
    Exit
EndFunc

Func DeleteGui()
    GUIDelete()
EndFunc

-edit-

Also, make sure you don't always use $ChildWin to create a child, because if you create more than one, the "DeleteGui" function will only delete the last one created.

Edited by Nahuel
Link to comment
Share on other sites

I'm pretty sure that some time ago I've seen something similar ... but can't find it now ...

Solutions?

- Use OnEventMode

- don't create child GUI

- use GUIDelete for child windows

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 350, 173, 193, 125)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Button1 = GUICtrlCreateButton("Create another GUI", 40, 96, 265, 33, 0)
GUICtrlSetOnEvent(-1, "Button1Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $Form2
While 1
    Sleep(100)
WEnd

Func Button1Click()
    $Form2 = GUICreate("Form2", 350, 173, 293, 225)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Form2Close")
    $Button2 = GUICtrlCreateButton("Do Nothing", 40, 96, 265, 33, 0)
    GUICtrlSetOnEvent(-1, "Button2Click")
    GUISetState(@SW_SHOW)
EndFunc

Func Form1Close()
    Exit
EndFunc

Func Form2Close()
    GUIDelete($Form2)
EndFunc

Func Button2Click()
    
EndFunc

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...