Sign in to follow this  
Followers 0
KurogamineNox

Minimize To Icon

3 posts in this topic

#1 ·  Posted (edited)

How do you minimize your GUI(Window) to the icon area, and have it come back by double clicking the icon?

Edited by KurogamineNox

Share this post


Link to post
Share on other sites



Is this what you mean?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
Opt ("TrayMenuMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 300, 300)
GUISetState(@SW_SHOW)
$restore = TrayCreateItem("Restore window")
TrayCreateItem("")
$exititem = TrayCreateItem("Exit")
TraySetState()
While 1
        $Tmsg = TrayGetMsg()
    $GMsg = GUIGetMsg()
    Select
        Case $GMsg  = $GUI_EVENT_CLOSE 
                Exit
        Case $GMsg = $GUI_EVENT_MINIMIZE
        GUISetState(@SW_HIDE,$Form1)
        Case $Tmsg = 0
            ContinueLoop
        Case $Tmsg = $TRAY_EVENT_PRIMARYDOUBLE
            Restore()
        Case $Tmsg = $exititem
            ExitLoop
            
    EndSelect
        
WEnd

Func Restore()
  GUISetState(@SW_SHOW)
  GUISetState(@SW_RESTORE)
EndFunc

Share this post


Link to post
Share on other sites

Is this what you mean?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
Opt ("TrayMenuMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 300, 300)
GUISetState(@SW_SHOW)
$restore = TrayCreateItem("Restore window")
TrayCreateItem("")
$exititem = TrayCreateItem("Exit")
TraySetState()
While 1
        $Tmsg = TrayGetMsg()
    $GMsg = GUIGetMsg()
    Select
        Case $GMsg  = $GUI_EVENT_CLOSE 
                Exit
        Case $GMsg = $GUI_EVENT_MINIMIZE
        GUISetState(@SW_HIDE,$Form1)
        Case $Tmsg = 0
            ContinueLoop
        Case $Tmsg = $TRAY_EVENT_PRIMARYDOUBLE
            Restore()
        Case $Tmsg = $exititem
            ExitLoop
            
    EndSelect
        
WEnd

Func Restore()
  GUISetState(@SW_SHOW)
  GUISetState(@SW_RESTORE)
EndFunc

It worked, thanks.

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