Jump to content

Restore from System Tray


grimmlock
 Share

Recommended Posts

I have 2 guis both of which minimize to the system tray like I want, however the first GUI when it is "restored" pops right up, and yet the second GUI, when it "restores", looks like it is flying in.

On the second GUI I have and want to have the minimize and Close butttons but how do I get is so that when the GUI is restored from the taskbar it does not fly in.

Code for the first GUI

#NoTrayIcon
#include <File.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>


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

TraySetOnEvent($TRAY_EVENT_PRIMARYUP,"SpecialEvent")

GUICreate("HelpDesk App", 300, 620, Default, Default, BitAND($WS_CAPTION, $WS_POPUP, $WS_SYSMENU), $WS_EX_CONTEXTHELP)

GUISetState()


Func SpecialEvent()
GUISetState(@SW_SHOW)
TraySetState(2) ; hide
EndFunc ;==> SpecialEvent

Code for the second GUI

#include <File.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <GUIConstants.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <Process.au3>
#include <WinAPI.au3>
#include <GUIComboBox.au3>
#Include <String.au3>
#include <Icons.au3>
#include <GuiTab.au3>
#include <GUIButton.au3>
#Include <TabConstants.au3>

#NoTrayIcon


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

TraySetOnEvent($TRAY_EVENT_PRIMARYUP,"SpecialEvent")
GUICreate("Utility v3.0", 315, 750)

GUISetState()


Func SpecialEvent()
GUISetState(@SW_SHOW)
TraySetState(2) ; hide
EndFunc ;==> SpecialEvent

Note* I have tried adding the same styles to the second GUI but it removes the Minimize and close buttons :(

Thanks,

Grimm

Edited by grimmlock

Thanks

Grimm

Link to comment
Share on other sites

First design two Gui's lets say the code goes like this:

#include <GUIConstantsEx.au3>


Opt("GUIOnEventMode", 1) ; Change to OnEvent mode

$Parent = GUICreate("Parent window", 200, 100)
$Button_Parent = GUICtrlCreateButton("Button1", 0, -1)
Guictrlsetonevent(-1, "Button1")
$Child = GUICreate("Child Window", 200, 100)
$Button_Child = GUICtrlCreateButton("Button2", 0, -1)
Guictrlsetonevent(-1, "Button2")

Func button1()
GUICtrlSetState ( $Parent, @sw_hide )
GUICtrlSetState ( $Child, @sw_show )
Endfunc

Func button2()
GUICtrlSetState ( $Parent, @sw_show)
GUICtrlSetState ( $Child, @sw_hide)
Exit
Endfunc

While 1
Wend
; you can use functions from this script to do the stuff you need to restore the gui you need from the systemtray

I hope this will do what you need your script to do...

Edited by ac1dm4n

[u]My dream is to have a dream...[/u]

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

×
×
  • Create New...