Sign in to follow this  
Followers 0
StungStang

Minimize application

2 posts in this topic

#1 ·  Posted (edited)

Hi to all, i've a simple script with tray menu.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt("TrayAutoPause", 0)
Opt("TrayMenuMode", 11)

;Tray Menu
$TrayRestore = TrayCreateItem("Restore")
TraySetState(2)

;Main Gui
$hGui = GUICreate("Test", 158, 57, 192, 124)
GUISetState(@SW_SHOW)

;HotKeys
HotKeySet("{F6}","_Restore")
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_MINIMIZE
            If IniRead(@ScriptDir & "\test.ini", "Setting", "Tray", "") = "1" Then
                TraySetState()
                GUISetState(@SW_HIDE)
            Else
                TraySetState(2)
            EndIf
        EndSwitch


        $tMsg = TrayGetMsg()
        Switch $tMsg
            Case $TrayRestore
                WinActivate($hGUI)
        EndSwitch
    WEnd
    
Func _Restore()
    ;==================Func Minimize==================
    ;If IniRead Tray = 1 Then minimize to tray!
    ;If IniRea Tray = 0 Then minimize to taskbar
    ;=================================================
    
    ;==================Func Maximize==================
    ;If application is minimized to tray or to taskbar
    ;Activate the main Gui
    ;=================================================
EndFunc

Application go minimized to tray only if the key "Tray" on file Test.ini is set to 1. In other case it will be minimized to taskbar. All ok...but...

I want to do a hotkey for that...

I would like that if i press F6 the application do that :

If IniRead Tray = 1 Then minimize the application to tray!

If IniRead Tray = 0 Then minimize the application to tray!

And have a restore function if the application is already minimized then show the main gui :)

I tried too much time but i have always issue...

How i can do that?...I hope that you have understand me :)

Hi!

Edited by StungStang

Share this post


Link to post
Share on other sites



Up :)

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