Sign in to follow this  
Followers 0
RagnaroktA

Minimize to Tray

7 posts in this topic




Beta have tray functions. Download it and look for examples.

<{POST_SNAPBACK}>

All I can find in the beta is tray menu functions... nothing about minimizing the GUI to the tray... Am I just blind?

Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki

Share this post


Link to post
Share on other sites

Updated from a post a while back:

#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")
TrayItemSetState(-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_SHOW);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

Forum search "+minimize +tray" :whistle:


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

lets suppose there are 3 or more GUIs & if you press:

$GUI_EVENT_MINIMIZE on GUI1 then all GUIS = @SW_HIDE, else = @SW_MINIMIZE ONLY the window where the $GUI_EVENT_MINIMIZE was pressed.

So I was experimenting, but this is really confusing ( I tried to use same principle as the $GUI_EVENT_CLOSE in this sample but as you see someting realy wierd happened ), also wierd things happened when i tried to set if winactive .. then @SW_HIDE etc. To be honest my logic is at its end hire atm. so all ideas how to explane this wierd behavior are welcome :whistle:

Case $msg = $GUI_EVENT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ÍÛÙÈH ÌÍÓÒÌÕRTÙ]Ý]JÕ×ÔÒÕË   ÌÍÑÕRLÊB[Ù[XÝÑ[

Share this post


Link to post
Share on other sites

Small tweak to get that tooltip working :)

Move the line to "after visible tooltip"

Updated from a post a while back:

#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")
TrayItemSetState(-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_SHOW);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
       TraySetToolTip("Click to restore window...")  ; The Tooltip text is only changed when the tray icon is visible.
  EndIf
WEnd

Forum search "+minimize +tray" ;)

Share this post


Link to post
Share on other sites

LeCarre,

Thanks for taking the trouble to post amended code, but we discourage necro-posting - 5 years since the previous post is far too long! :)

M23


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

Spoiler

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

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