Jump to content

Mimimize to Icon Taskbar


daveed
 Share

Recommended Posts

#NoTrayIcon
#include <GuiConstants.au3>
#include <Constants.au3>

Opt("TrayOnEventMode",1)
Opt("TrayMenuMode",1) 
  
TraySetOnEvent($TRAY_EVENT_PRIMARYUP,"SpecialEvent")
;~ TraySetState(2) ; hide

GuiCreate("MyGUI", 392, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
GuiSetState()

While 1
    $msg = GuiGetMsg()
        Select
        Case $msg = $GUI_EVENT_MINIMIZE 
            TrayShow(1) ; show

        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd

Func SpecialEvent()
    TrayShow(0) ; hide
EndFunc

Func TrayShow($show) ; 0/1 hide/show
    If $show Then
        GuiSetState(@SW_HIDE)
        TraySetState(1) ; show
        TraySetToolTip ("My app - click here to restore")
    Else
        GuiSetState(@SW_Show)
        TraySetState(2) ; hide
    EndIf
EndFunc

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...