igmeou Posted March 8, 2005 Share Posted March 8, 2005 Hi, i'm wondering is there a way to get rid of my program on the taskbar when i minimise my program and only left a trayicon if a user wanted to get back to the program? [font="Arial"]Thanks[/font]If @error = me Then $sorry Else Do $clarifyMe Until $meClear EndIF MsgBox(0,"Special Message!","Special Thanks to " & $allHadReplied,$Forever) Link to comment Share on other sites More sharing options...
CyberSlug Posted March 8, 2005 Share Posted March 8, 2005 Yes, using this beta version of AutoIt which has Holger's TrayMenu/Icon enhancements: http://www.autoitscript.com/forum/index.php?showtopic=9202Is your program one you are making with AutoIt GUI or is it just some other program? I could give examples either way Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
igmeou Posted March 9, 2005 Author Share Posted March 9, 2005 Thanks CyberSlug. I'm going through the forum now. I'm trying to right a simple alarm clock program using AutoIt GUI. I want it to be in the Tray Icon when I minimize it. If you have any examples of doing this, I'll open my hands wide to hug you. [font="Arial"]Thanks[/font]If @error = me Then $sorry Else Do $clarifyMe Until $meClear EndIF MsgBox(0,"Special Message!","Special Thanks to " & $allHadReplied,$Forever) Link to comment Share on other sites More sharing options...
Steph Posted March 9, 2005 Share Posted March 9, 2005 Try this to get you started:expandcollapse popup; Minimise to tray example ; Steph - 09/03/2005 ;********************************************************************* ; Options ;********************************************************************* Opt("MustDeclareVars", 1) ; Require that variables are declared (Dim) before use Opt("TrayMenuMode",1) ; No pause or exit item TraySetClick(16) ; only right (secondary) click will show the tray menu ;********************************************************************* ; Constants ;********************************************************************* #include <GuiConstants.au3> ; Tray constants Const $TRAY_EVENT_PRIMARYDOUBLE = -13 ;********************************************************************* ; Variables ;********************************************************************* ; GUI variables: ed = edit box, lb = label, ud = updown, bt = button Global $gui_Main ; GUI items for hide & exit buttons Global $bt_main_Hide, $bt_main_Exit ; Tray items Global $mn_tray_Exit, $mn_tray_show Dim $msg, $traymsg CreateGui() CreateTray() Do $msg = GUIGetMsg() $traymsg = TrayGetMsg() Select Case $msg = $bt_main_Hide GUISetState(@SW_HIDE, $gui_main) Case $traymsg = $TRAY_EVENT_PRIMARYDOUBLE or $traymsg = $mn_tray_Show GUISetState(@SW_SHOW, $gui_main) EndSelect Until $msg = $GUI_EVENT_CLOSE Or $msg=$bt_main_Exit Or $traymsg = $mn_tray_Exit Exit ;********************************************************************* ; Create the GUI ;********************************************************************* Func CreateGui() $gui_Main = GuiCreate("Hide to tray demo", 405, 280, -1, -1, $WS_EX_DLGMODALFRAME ) $bt_main_Hide = GUICtrlCreateButton("Hide", 280, 195, 110, 20) $bt_main_Exit = GUICtrlCreateButton("Exit", 280, 220, 110, 20) EndFunc ;********************************************************************* ; Create the Tray items ;********************************************************************* Func CreateTray() $mn_tray_show = TrayCreateItem("Show") TrayCreateItem("") $mn_tray_Exit = TrayCreateItem("Exit") EndFuncDouble click on the 'AutoIt' icon in the tray to show the window, or right click and select show. Use the 'hide' button to make the window disappear. Exit using button in window or right click on 'AutoIt' icon and select 'Exit'.This needs Holger's tray stuff (in latest beta) - click here and is based on what I did for 'PingIt' which you can find in my file area (http://www.autoitscript.com/fileman/users/public/Steph/).Hope this helps.Steph Link to comment Share on other sites More sharing options...
CyberSlug Posted March 9, 2005 Share Posted March 9, 2005 (edited) Another example, though not commented as nicely as Steph's: #include <GuiConstants.au3> Global Const $TRAY_DEFAULT = 512 #NoTrayIcon;at least not icon at the very beginning Opt("TrayAutoPause", 0) Opt("TrayMenuMode", 1) GuiCreate("Minimzes to tray") GuiSetState(@SW_SHOW) $foo = TrayCreateItem("Restore Window") TraySetItemState(-1, $TRAY_DEFAULT) TraySetClick ( 0 );don't show menu item when clicked TraySetToolTip("Click to restore window...") ;Does this function work? While 1 $trayMsg = TrayGetMsg() If $trayMsg = $foo Then GuiSetState(@SW_RESTORE) ;show GUI Opt("TrayIconHide", 1);hide tray icon EndIf $msg = GuiGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $GUI_EVENT_MINIMIZE Then GuiSetState(@SW_HIDE) ;hide GUI Opt("TrayIconHide", 0);show tray icon EndIf WEnd Edited March 9, 2005 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
igmeou Posted March 9, 2005 Author Share Posted March 9, 2005 All right guys. Thanks! This will be enough for me to carry on my work. [font="Arial"]Thanks[/font]If @error = me Then $sorry Else Do $clarifyMe Until $meClear EndIF MsgBox(0,"Special Message!","Special Thanks to " & $allHadReplied,$Forever) 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