Jump to content
Sign in to follow this  
BobiusMaximus

Minimize To Tray

Recommended Posts

BobiusMaximus

I can't seem to find out which help file makes your GUI minimize down to the system try.

Can anyone point me in the right direction?

-Bob


Photoshop User and Noob AutoIt user.

Share this post


Link to post
Share on other sites
Rick

firstly, dont use #NoTrayIcon in your script but use AutoItSetOption ( "TrayIconHide",1) to not show icon in systray when gui is displayed as it will be on your taskbar anyway, then do a check for when minimised hide the gui (to take it away from the taskbar), and set AutoItSetOption ( "TrayIconHide",0) to reshow the icon in the systray , and then create a menu choice(if preferred) on the sytray icon to restore it.

heres an example, its not perfect but i'll leave you to play with it

#include <GUIConstants.au3>

$Title="My GUI"

$GUI=GUICreate($Title)

GUISetState (@SW_SHOW)

opt("TrayIconHide",1)

Opt("TrayMenuMode",1)

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

if TrayGetMsg() = -7 then ; if icon clicked ($TRAY_EVENT_PRIMARYDOWN)

GUISetState(@SW_SHOW,$GUI) ; put back onto taskbar

GUISetState(@SW_RESTORE,$GUI) ;restore what was minimised

opt("TrayIconHide",1) ; hide systray icon

endif

if NOT WinActive("My GUI") then

GUISetState(@SW_HIDE,$GUI) ; hide from taskbar

opt("TrayIconHide",0) ; display systray icon

TraySetToolTip($Title) ; icon title

endif

Wend

Edited by Rick

Who needs puzzles when we have AutoIt!!

Share this post


Link to post
Share on other sites
BobiusMaximus

Interesting, it works, but I'm kinda confused as to how I add this into my own script.

-Bob

Edit: Nvm, I think I got it ;)

Edited by BobTheLeetHaxx0r

Photoshop User and Noob AutoIt user.

Share this post


Link to post
Share on other sites
Rick

put the script here and i'll have a go


Who needs puzzles when we have AutoIt!!

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  

×