#NoTrayIcon
#include <Constants.au3>
# Запуск программы "RMS Агент"
Run ("G:\Program Files\RMSAgentPortable\agent.exe", "", "" )
# Ожидаем появления окна программы "RMS Агент" с заголовком " RMS Агент "
$hWnd = WinWait ( "RMS Агент", "" )
# Активируем окно программы "RMS Агент" с заголовком " RMS Агент "
WinActivate ( $hWnd, "" )
WinWaitActive ( $hWnd, "" )
WinSetOnTop ( $hWnd, "", 1 )
WinSetState("RMS Агент", "", @SW_HIDE)
Opt("TrayMenuMode", 1)
Global $sCurrent_Title = ""
HotKeySet("^+h", "_MinimizeWindow_Proc")
While 1
Switch TrayGetMsg()
Case $TRAY_EVENT_PRIMARYUP
_MinimizeWindow_Proc()
EndSwitch
WEnd
Func _MinimizeWindow_Proc()
If $sCurrent_Title <> "" Then
Opt("TrayIconHide", 1)
WinSetState($sCurrent_Title, "", @SW_SHOW)
WinActivate($sCurrent_Title)
$sCurrent_Title = ""
Return
EndIf
$sCurrent_Title = WinGetTitle("")
If $sCurrent_Title = "" Then Return
Opt("TrayIconHide", 0)
WinSetState($sCurrent_Title, "", @SW_HIDE)
TraySetToolTip($sCurrent_Title)
EndFunc