Sign in to follow this  
Followers 0
DexterMorgan

Hi

6 posts in this topic

#1 ·  Posted (edited)

Hi all, i was wondering if there is a way to minimize a GUI to the traybar and when you click on the traybar icon it would open up again.

Thank you for your help

Lol guess its not possible thank you anyways

Edited by Nooblet

code

Share this post


Link to post
Share on other sites



Like this?

#include <GUIConstants.au3>

Opt("TrayIconHide",1)
Opt("TrayMenuMode",1)
$trayrestore = TrayCreateItem("Restore")
TrayCreateItem("")
$trayexit = TrayCreateItem("Exit")

$gui = GuiCreate("WindowName")
GUISetState()

While 1 
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_MINIMIZE then 
        Opt("TrayIconHide",0)
        WinSetState("WindowName","",@SW_HIDE)
        
        While 1
            $traymsg = TrayGetMsg()
            
            if $traymsg = $trayrestore Then
                Opt("TrayIconHide",1)
                WinSetState("WindowName","",@SW_SHOW)
                WinSetState("WindowName","",@SW_RESTORE)
                ExitLoop
            EndIf
            
            if $traymsg = $trayexit then 
                Exit
            EndIf
        WEnd
    EndIf
    
    If $msg = $GUI_EVENT_CLOSE Then Exit
WEnd

Share this post


Link to post
Share on other sites

#NoTrayIcon
$GUI = GUICreate("")
GUISetState()
Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 1)
#include <Constants.au3>
#include <GUIConstants.au3>
$Label1 = GUICtrlCreateLabel("", 15, 88, 346, 41, $SS_CENTER)
GUICtrlSetFont(-1, 65, 400, 0, "MS Sans Serif")
TraySetOnEvent($TRAY_EVENT_PRIMARYUP, "Minimize")
AdlibEnable("Time", 1000)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_MINIMIZE
            GUISetState(@SW_HIDE, $GUI)
            TraySetState(1)
        EndSwitch
    WEnd
    
    Func Minimize()
    TraySetState(2)
    GUISetState(@SW_SHOW, $GUI)
    GUISetState(@SW_RESTORE, $GUI)
EndFunc  ;==>Minimize

Func Time()
    $Time = @Hour & ":" & @MIN & ":" & @SEC
    GUICtrlSetData($Label1, $Time)
    WinSetTitle($GUI, "", $Time & " Is The Current Time")
EndFunc

Share this post


Link to post
Share on other sites

I like mine better :)

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