Jump to content

using TrayGetMsg() and GUIGetMsg()


Recommended Posts

I took this small example out of the helpfile and modified it to my liking. what i wanted was to have gui controls and tray controls and handle both of their events, but this script below only handles the tray events and not the gui controls events either.

i need some help, can someone tell me why the button doesn't work and the tray items do?

#include <guiconstants.au3>
#NoTrayIcon

Opt("TrayMenuMode",1)   ; Default tray menu items (Script Paused/Exit) will not be shown.

guicreate("", 300, 300)
$n = GUICtrlCreateButton("", 30, 30, 30, 30)
guisetstate()

$prefsitem  = TrayCreateItem("Preferences")
TrayCreateItem("")
$aboutitem  = TrayCreateItem("About")
TrayCreateItem("")
$exititem   = TrayCreateItem("Exit")

TraySetState()

While 1
    $msg = GUIGetMsg()
    $imsg = TrayGetMsg()
    Select
        Case $imsg = 0
            ContinueLoop
        Case $imsg = $prefsitem
            Msgbox(64, "Preferences:", "OS:" & @OSVersion)
        Case $imsg = $aboutitem
            Msgbox(64, "About:", "AutoIt3-Tray-sample.")
        Case $imsg = $exititem
            ExitLoop
        Case $msg = $n
            msgbox(0, "", "")
    EndSelect
WEnd
Link to comment
Share on other sites

Case $imsg = 0

ContinueLoop

When there is no tray MSG, you continue the loop. You should delete zhis case muttley

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

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