Jump to content
Sign in to follow this  
Tukata

System Tray question

Recommended Posts

Tukata

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

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
Tukata

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

Share this post


Link to post
Share on other sites
AzKay

Show which window?


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites
AzKay

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

Share this post


Link to post
Share on other sites
Tukata

AzKay

Thanks a lot. Now it works fine.

Now how I can make it run on startup ? On and Off ?

Thank you

Tuk

Edited by Tukata

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.