Jump to content

Default Microsoft Windows Tray Template


Recommended Posts

For the life of me I can't get a the tray to act like a standard Microsoft Windows tray.

Primary Click: Does nothing

Primary Double Click: Hides/Show GUI

Secondary Click: Shows Menu Items

Also how do you set a tray icon to be one that is "checkable" and one that is not?

Link to comment
Share on other sites

Found the secret that was messing me up:

TraySetClick(8)

Never knew about the function. Argg.

Anyways heres what I got:

#include <Constants.au3>

Opt("TrayOnEventMode", 1) ; Use event trapping for tray menu
Opt("TrayMenuMode", 3) ; Default tray menu items will not be shown.

TrayCreateItem("About")
TrayItemSetOnEvent(-1, "On_About")
TrayCreateItem("")
TrayCreateItem("Exit")
TrayItemSetOnEvent(-1, "On_Exit")

TraySetState()

TraySetClick(8)

TraySetOnEvent($TRAY_EVENT_PRIMARYUP, "_DoNothing")
TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE, "_ShowGUI")

While 1
    sleep(100)
WEnd


Func _DoNothing()
EndFunc   ;==>_DoNothing


Func _ShowGUI()
    TrayTip("GUI", "Hello World", 1)
EndFunc   ;==>_ShowGUI

Func On_About()
    MsgBox(0, "About", "Whatever")
EndFunc   ;==>On_About

Func On_Exit()
    Exit
EndFunc   ;==>On_Exit
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...