Sign in to follow this  
Followers 0
Guest Nocturne

How do I Minimize to System Tray

3 posts in this topic

Hello, Im trying to figure out how to minimize a GUI made program to system tray so that it does not show on the task bar when it is minimized. How do I go about coding this into my program.

Thanks in advance

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

With the present release you can't really do this, not so that you can restore from TrayIcon anyway. To hide the taskbar button though, you must create two GUI's. Gui1 is never displayed, and Gui2 is a child of Gui1. Child GUI's do not get taskbar buttons, so if you display Gui2, but not Gui1, the window will appear, but no taskbar button will be seen.

$Gui1 = GuiCreate('Hidden Window')
$Gui2 = GuiCreate('My Gui', 200, 300, -1, -1, -1, -1, $Gui1)

GuiSetState()

While 1
    $i_Msg = GuiGetMsg()

    Select
        Case $i_Msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd

This is just a starting point. But it demonstrates how to hide the taskbar button...

Of course, after rereading your post and my post I realized that's not what you're even looking for... In the slightest. But because I typed it all up already I'm not erasing it.

I will add this however.

To minimize to system tray is really just to hide your GUI window, and create a system tray icon.

So something like this:

#NoTrayIcon
$Gui = GuiCreate('My Gui', 200, 300)

GuiSetState()

While 1
    $i_Msg = GuiGetMsg()

    Select
        Case $i_Msg = $GUI_EVENT_MINIMIZE
            GuiSetState(@SW_HIDE, $Gui)
            Opt('TrayIconHide', 0)
        Case $i_Msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd

Only problem is, with the current release, you can't have the system tray act to restore windows. Only pause and exit the script.

Edited by Saunders

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