Sign in to follow this  
Followers 0
brokenbeforetime

GUICtrlSetOnEvent with system tray menu?

3 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

TraySetOnEvent

Edit:

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

Edited by SmOke_N
1 person likes this

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

ahhh...thanks :thumbsup:

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  
Followers 0