Jump to content
Sign in to follow this  

GUICtrlSetOnEvent with system tray menu?

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

func EXITButton()

Share this post

Link to post
Share on other sites



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

Edited by SmOke_N
  • Like 1

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

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.