Jump to content

Recommended Posts

Posted (edited)

Hi! Try this example:

#include <GuiConstants.au3>

Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 1)

$hGui = GUICreate("Test GUI", 300, 200)

$TrayRestore = TrayCreateItem("Restore")
TrayItemSetOnEvent(-1, "TrayEvent")

TrayCreateItem("")

$TrayExit = TrayCreateItem("Exit")
TrayItemSetOnEvent(-1, "TrayEvent")

GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
        ExitLoop
    Case $GUI_EVENT_MINIMIZE
        GUISetState(@SW_HIDE)
    EndSwitch
WEnd

Func TrayEvent()
    Switch @TRAY_ID
    Case $TrayRestore
        If Not BitAND(WinGetState($hGui), 2) Then
            GUISetState(@SW_SHOW, $hGui)
            GUISetState(@SW_RESTORE, $hGui)
        EndIf
    Case $TrayExit
        Exit
    EndSwitch
EndFunc ;==>TrayEvent
:) Edited by rasim

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
×
×
  • Create New...