#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$hTarget_Win = WinGetHandle("[CLASS:rctrl_renwnd32]")
$aOld_WinPos = WinGetPos($hTarget_Win)
$iOld_WinState = WinGetState($hTarget_Win)
If Not IsHWnd($hTarget_Win) Then Exit
$hGUI = GUICreate("", 17, 0, $aOld_WinPos[0] + $aOld_WinPos[2] - 27, $aOld_WinPos[1] + 3, -1, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW), $hTarget_Win)
If BitAND($iOld_WinState, 8) = 8 Then GUISetState(@SW_SHOW, $hGUI)
While 1
$aWinPos = WinGetPos($hTarget_Win)
$iWinState = WinGetState($hTarget_Win)
If @error Then
Exit
EndIf
If $iOld_WinState <> $iWinState Then
$iOld_WinState = $iWinState
If BitAND($iWinState, 8) = 8 Then
GUISetState(@SW_SHOW)
WinActivate($hTarget_Win)
Else
GUISetState(@SW_HIDE)
EndIf
EndIf
If $aOld_WinPos[0] <> $aWinPos[0] Or $aOld_WinPos[1] <> $aWinPos[1] Then
$aOld_WinPos = $aWinPos
WinMove($hGUI, "", $aWinPos[0] + $aWinPos[2] - 27, $aWinPos[1] + 3)
EndIf
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
WinSetState($hTarget_Win, "", @SW_MINIMIZE)
EndSwitch
WEnd