Jump to content

System Tray question


Tukata
 Share

Recommended Posts

  • Moderators

Hi,

I tried to do it myself but failed. I want my app to start in Tray and appear on click on icon (left or right click). And I need a button to send it back to tray.

Thank you

Tuk

:whistle:

So... where is what you tried?

Did you try:

TrayCreateItem, TrayCreateMenu, Opt('TrayMenuMode'1,2,4,8) or

TrayGetMsg() or Opt('TrayOnEventMode', 1)? If you did, show us what you've done.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Thank you. Here is my script.

Where I wrote "Show app window" I want to show the window.

And the window should be hidden On Start.

The Button will hide the window again.

#Include <Constants.au3>
#NoTrayIcon
GUICreate("Caption", 430, 250)
$Button = GUICtrlCreateButton ( "Send to Tray",  10, 10)
GUISetState ()

Opt("TrayMenuMode",1)

$Show= TrayCreateItem("Show")
TrayCreateItem("")
$about = TrayCreateItem("About")
TrayCreateItem("")
$exit = TrayCreateItem("Exit")
TrayCreateItem("")

TraySetState()

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop
        Case $msg = $Show
          ;; Show app window
        Case $msg = $about
            Msgbox(64,"About:","AutoIt3")
        Case $msg = $exit
            ExitLoop
    EndSelect
WEnd

Exit
Edited by Tukata
Link to comment
Share on other sites

#Include <Constants.au3>
#NoTrayIcon
Opt("TrayMenuMode", 1)

GUICreate("Caption", 430, 250)
$Button = GUICtrlCreateButton ( "Send to Tray",  10, 10)
GUISetState (@SW_HIDE)

$Show= TrayCreateItem("Show")
TrayCreateItem("")
$about = TrayCreateItem("About")
TrayCreateItem("")
$exit = TrayCreateItem("Exit")
TrayCreateItem("")

TraySetState()

While 1
    $msg = TrayGetMsg()
    $xmsg = GUIGetMsg()
    Select
        Case $xmsg = $Button
            WinSetState("Caption", "", @SW_HIDE)
        Case $msg = $Show
            WinSetState("Caption", "", @SW_SHOW)
        Case $msg = $about
            Msgbox(64,"about:","AutoIt3")
        Case $msg = $exit
            ExitLoop
    EndSelect
WEnd

Exit

Edited by AzKay
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
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...