Sign in to follow this  
Followers 0
Darkbeo

About GUI How Close?

6 posts in this topic

#1 ·  Posted (edited)

How i can close this GUI on click OK?

;~ --------------------------------------------------------------------------------------------
;~ Includes
;~ --------------------------------------------------------------------------------------------
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
;~ --------------------------------------------------------------------------------------------

;~ --------------------------------------------------------------------------------------------
;~ Opções de Parametros/Funções
;~ --------------------------------------------------------------------------------------------
Opt("TrayMenuMode",1)
;~ --------------------------------------------------------------------------------------------

;~ --------------------------------------------------------------------------------------------
;~ Menu do SistemTray
;~ --------------------------------------------------------------------------------------------
$aboutitem      = TrayCreateItem("About...")
TrayCreateItem("")
$exititem       = TrayCreateItem("Exit")

TraySetState()
TraySetToolTip("Test")
;~ --------------------------------------------------------------------------------------------

;~ --------------------------------------------------------------------------------------------
;~ Funções do About...
;~ --------------------------------------------------------------------------------------------
Func About()
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("About", 324, 241, 303, 219, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS))
    GUISetIcon("D:\006.ico")
    $GroupBox1 = GUICtrlCreateGroup("", 8, 8, 305, 185)
    $Image1 = GUICtrlCreatePic("", 16, 24, 105, 97)
    $Label1 = GUICtrlCreateLabel("Product Name", 152, 24, 72, 17, $WS_GROUP)
    $Label2 = GUICtrlCreateLabel("Version", 152, 48, 39, 17, $WS_GROUP)
    $Label4 = GUICtrlCreateLabel("Comments", 16, 160, 53, 17, $WS_GROUP)
    $Label3 = GUICtrlCreateLabel("Copyright", 16, 136, 48, 17, $WS_GROUP)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Button1 = GUICtrlCreateButton("&OK", 112, 208, 75, 25)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    While 1
        $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc
;~ --------------------------------------------------------------------------------------------

;~ --------------------------------------------------------------------------------------------
;~ While de Repetição dos comandos
;~ --------------------------------------------------------------------------------------------
While 1
    $msgTray = TrayGetMsg()
    Select
        Case $msgTray = $aboutitem
            About()
        Case $msgTray = $exititem
            Exit
    EndSelect
    Sleep(50)
WEnd
;~ --------------------------------------------------------------------------------------------

Thanks if can help me....

Edited by Darkbeo

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Just use this case like you do with the others:

Case $button1
Exit

Regards

EDIT: Sorry i was too fast.. give me a little time then I'll post how to do.

Edited by newbiescripter

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Here is what you can do:

;~ --------------------------------------------------------------------------------------------
;~ Includes
;~ --------------------------------------------------------------------------------------------
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
;~ --------------------------------------------------------------------------------------------

;~ --------------------------------------------------------------------------------------------
;~ Opções de Parametros/Funções
;~ --------------------------------------------------------------------------------------------
Opt("TrayMenuMode",1)
;~ --------------------------------------------------------------------------------------------

;~ --------------------------------------------------------------------------------------------
;~ Menu do SistemTray
;~ --------------------------------------------------------------------------------------------
$aboutitem      = TrayCreateItem("About...")
TrayCreateItem("")
$exititem       = TrayCreateItem("Exit")

TraySetState()
TraySetToolTip("Test")
;~ --------------------------------------------------------------------------------------------

;~ --------------------------------------------------------------------------------------------
;~ Funções do About...
;~ --------------------------------------------------------------------------------------------
Func About()
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("About", 324, 241, 303, 219, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS))
    GUISetIcon("D:\006.ico")
    $GroupBox1 = GUICtrlCreateGroup("", 8, 8, 305, 185)
    $Image1 = GUICtrlCreatePic("", 16, 24, 105, 97)
    $Label1 = GUICtrlCreateLabel("Product Name", 152, 24, 72, 17, $WS_GROUP)
    $Label2 = GUICtrlCreateLabel("Version", 152, 48, 39, 17, $WS_GROUP)
    $Label4 = GUICtrlCreateLabel("Comments", 16, 160, 53, 17, $WS_GROUP)
    $Label3 = GUICtrlCreateLabel("Copyright", 16, 136, 48, 17, $WS_GROUP)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Button1 = GUICtrlCreateButton("&OK", 112, 208, 75, 25)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    While 1
        $msg = GUIGetMsg()
        Switch $msg
            Case $GUI_EVENT_CLOSE
                GUIDelete("About")
                ExitLoop
            Case $Button1
                GUIDelete("About")
                ExitLoop
        EndSwitch
    WEnd
EndFunc
;~ --------------------------------------------------------------------------------------------

;~ --------------------------------------------------------------------------------------------
;~ While de Repetição dos comandos
;~ --------------------------------------------------------------------------------------------
While 1
    $msgTray = TrayGetMsg()
    Select
        Case $msgTray = $aboutitem
            About()
        Case $msgTray = $exititem
            Exit
    EndSelect
    Sleep(50)
WEnd
;~ --------------------------------------------------------------------------------------------

Regards

EDIT: This is the one I'm talking about down under.. :)

Edited by newbiescripter

Share this post


Link to post
Share on other sites

Just use this case like you do with the others:

Case $button1
Exit

Regards

EDIT: Sorry i was too fast.. give me a little time then I'll post how to do.

Exit will close the program... i need close only about windows...

Share this post


Link to post
Share on other sites

Exit will close the program... i need close only about windows...

Yes. sorry I was a little to fast on that one.. But I've also posted a new solution above and that should works.

Regards

Share this post


Link to post
Share on other sites

is exactly what i needed... Very Thanks newbiescripter :)

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