#NoTrayIcon
#include <WinAPI.au3>
#include <GUIConstants.au3>
Local $hApp = WinWait("My App")
Local $iHeight = _WinAPI_GetSystemMetrics($SM_CYCAPTION)
Local $iWidth = 100
Local $aPos = WinGetPos($hApp), $aPosPrev = $aPos
Local $hOver = GUICreate("Over", $iWidth - 8, $iHeight + 7, $aPos[0] + $aPos[2] - $iWidth, $aPos[1] + 1, $WS_POPUP, $WS_EX_TOOLWINDOW, $hApp) ; * <- 1
;~ GUISetBkColor(0xFFFFFF)
GUISetState(@SW_SHOWNOACTIVATE)
WinActivate($hApp) ; * <- 2
$newColor = PixelGetColor($aPos[0] + $aPos[2] - 106, $aPos[1] + 14)
GUISetBkColor($newColor, $hOver)
;~ _WinAPI_SetWindowLong($hOver, $GWL_HWNDPARENT, $hApp)
While WinExists($hApp)
Sleep(10)
;~ $newColor = PixelGetColor($aPos[0] + $aPos[2] - 106, $aPos[1] + 14)
;~ GUISetBkColor($newColor, $hOver)
If WinActive($hOver) Then WinActivate($hApp) ; * <- 3
$aPos = WinGetPos($hApp)
If @error Then Exit ConsoleWrite('-> unexpected exit' & @CRLF) ; * <- 4
If $aPos[0] = $aPosPrev[0] And $aPos[1] = $aPosPrev[1] Then ContinueLoop
$aPosPrev = $aPos ; * <- 5
WinMove($hOver, "", $aPos[0] + $aPos[2] - $iWidth, $aPos[1] + 1)
WEnd