Jump to content

GUICtrlSetOnEvent with system tray menu?


Go to solution Solved by SmOke_N,

Recommended Posts

Can anyone tell me why this code doesn't work? It wont run the EXITButton function when I click the system tray menu... It works with a form and a button but not a system tray menu... is it suppouse to? am I missing somthing? Thanks.

#include <GUIConstantsEx.au3>

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
Opt("TrayMenuMode", 3) ; The default tray menu items will not be shown and items are not checked when selected. These are options 1 and 2 for TrayMenuMode.

Local $idExit = TrayCreateItem("Exit")
GUICtrlSetOnEvent($idExit, "EXITButton")

While 1
    Sleep(1000) ; Sleep to reduce CPU usage
WEnd

func EXITButton()
    Exit
EndFunc
Link to comment
Share on other sites

  • Moderators
  • Solution

TraySetOnEvent

Edit:

Don't forget Opt("TrayOnEventMode", 1)

Edited by SmOke_N

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

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