Jump to content
Sign in to follow this  

tray application that show popup GUI - need help

Recommended Posts



I'm trying to prepare tray application that show popup GUI. :) Problem is with event that shows/hides popup GUI. I don't know how to show popup GUI when cursor is on tray icon and how to hide it when cursor is out of tray icon.

I used "$TRAY_EVENT_MOUSEOVER" it shows popup but I can't hide it automaticaly.

Please help....

Share this post

Link to post
Share on other sites

maybe make hide to tray by hotkey

Share this post

Link to post
Share on other sites

maybe make hide to tray by hotkey

I want do some automatic popup. When I put mouse cursor on tray icon it shows up when I take off mouse it dispersers.

Share this post

Link to post
Share on other sites


Firstly, do not bump a post within 24 hours again. These forums are not a 24/7 tech support - if someone can help you they will, but you need to be patient. If you are not....you will get no help! :-)

But you do get help this time. I think this is what you are looking for - the GUI appears when your cursor is over the icon and vanishes when you move away:

#include <GUIConstantsEx.au3>
#include <Constants.au3>
#Include <GuiToolBar.au3>

Global $aIcon[4]

$hWin = GUICreate("Test", 100, 100)
GUISetState(@SW_HIDE, $hWin)

$fShowing = False

While 1
    If GUIGetMsg() = -3 Then Exit
    $aMouse = MouseGetPos()
    If $aMouse[0] >= $aIcon[0] And $aMouse[0] <= $aIcon[2] And $aMouse[1] >= $aIcon[1] And $aMouse <= $aIcon[3] Then
    ; Over icon
        If $fShowing = False Then
            $fShowing = True
            GUISetState(@SW_SHOW, $hWin)
            ConsoleWrite("Showing" & @CRLF)
    ; Off icon
        If $fShowing Then
            ConsoleWrite("Hidden" & @CRLF)
            GUISetState(@SW_HIDE, $hWin)
            $fShowing = False

Func Find_Icon()

; Find systray handle
$SysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]')
If @error Then
    MsgBox(16, "Error", "System tray not found")

; Get systray item count
$Systray_ButCount = _GUICtrlToolbar_ButtonCount($SysTray_Handle)
If $Systray_ButCount = 0 Then
    MsgBox(16, "Error", "No items found in system tray")

; Look for tooltip
$Tool_Tip = ""
For $Systray_ButtonNumber = 0 To $Systray_ButCount - 1
; Need to change "AutoIt" to name of your exe when compiled
    $Test = StringSplit(_GUICtrlToolbar_GetButtonText($SysTray_Handle, $Systray_ButtonNumber), "AutoIt" ,1)
    If $Test[0] <> 1 Then ExitLoop

If $Systray_ButtonNumber = $Systray_ButCount Then
; Icon not found
    MsgBox(16, "Error", "AutoIt icon not found in system tray")
; Get absolute coords of icon
; get icon size
    $aIcon = _GUICtrlToolbar_GetButtonRect($SysTray_Handle, $Systray_ButtonNumber)
; get x coord of systray
    $aSysTray = ControlGetPos('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]')
    $aIcon[0] = $aSysTray[0]
    $aIcon[2] = $aSysTray[0] + $aIcon[2]
; get y coord of taskbar
    $aTaskBar = WinGetPos('[Class:Shell_TrayWnd]', '')
    $aIcon[1] = $aTaskBar[1]
    $aIcon[3] = $aTaskBar[1] + $aIcon[3]


Please ask if there is anything you do not understand.


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


Share this post

Link to post
Share on other sites

Thank you very much. That is what I looking for...


Edited by fizyk

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