Sign in to follow this  
Followers 0
benson

Minimize to tray?

3 posts in this topic

Hi

For example, i have a program that starts a process after clicking a start button.

How do i make the program MINIMIZE TO THE SYSTEM TRAY after clicking the start button?

After it runs the program, how do i make it restore automatically?

Thanks.

Share this post


Link to post
Share on other sites



Use GUISetState ( [flag [, winhandle]] )



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

just like BigDod said

check the example:

#include <GUIConstants.au3>
Opt('TrayMenuMode', 1)

$main = GUICreate("Test", 200, 80)
$go = GUICtrlCreateButton ("Minimize to Tray", 10, 10, 150,25)
$exit = GUICtrlCreateButton ("exit", 10, 40, 150,25)
$tray_hide = TrayCreateItem ("Hide Gui")
TrayCreateItem ("")
$tray_Restore = TrayCreateItem ("Restore Gui")
TrayCreateItem ("")
$tray_exit = TrayCreateItem ("Exit")
TrayItemSetState ($tray_Restore,$gui_disable)
GUISetState ()

While 1
    $msg = GUIGetMsg()
    $msgt = TrayGetMsg()
    _hide()
    _show()
    _exit()
Wend

Func _hide()
    If $msg = $go Then
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $main, "int", 100, "long", 0x00090000);fade-out
        TrayItemSetState ($tray_Restore,$gui_enable)
        TrayItemSetState ($tray_hide,$gui_disable)
    EndIf
    If $msgt = $tray_hide Then
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $main, "int", 100, "long", 0x00090000);fade-out
        TrayItemSetState ($tray_Restore,$gui_enable)
        TrayItemSetState ($tray_hide,$gui_disable)
    EndIf
EndFunc

Func _show()
    If $msgt = $tray_Restore Then
        TrayItemSetState ($tray_Restore,$gui_disable)
        TrayItemSetState ($tray_hide,$gui_enable)
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Main, "int", 200, "long", 0x00080000);fade-in
    EndIf
EndFunc

Func _exit()
    If $msg = $exit Or $msg = $gui_event_close Or $msgt = $tray_exit Then
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Main, "int", 500, "long", 0x00050010);implode
        Exit
    EndIf
EndFunc

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

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