benson Posted January 23, 2008 Share Posted January 23, 2008 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. Link to comment Share on other sites More sharing options...
BigDod Posted January 23, 2008 Share Posted January 23, 2008 Use GUISetState ( [flag [, winhandle]] ) 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 Link to comment Share on other sites More sharing options...
star2 Posted January 23, 2008 Share Posted January 23, 2008 just like BigDod said check the example: expandcollapse popup#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] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now