#Include <WindowsConstants.au3>
Global $X, $Y
Run('Calc.exe')
If Not WinWait('Калькулятор Плюс', '', 3) Then
MsgBox(0, '', 'Калькулятор Плюс not found!')
Exit
EndIf
$hWnd = WinGetHandle('Калькулятор Плюс')
$hForm = GUICreate('', 50, 19, -1, -1, $WS_POPUP, -1, $hWnd)
$Button = GUICtrlCreateButton('OK', 0, 0, 50, 19)
GUISetState(@SW_SHOWNOACTIVATE)
While 1
$Pos = WinGetPos($hWnd)
If @error Then
Exit
EndIf
If ($X <> $Pos[0]) Or ($Y <> $Pos[1]) Then
$X = $Pos[0]
$Y = $Pos[1]
WinMove($hForm, '', $X + 201, $Y + 29)
EndIf
$Msg = GUIGetMsg()
Switch $Msg
Case $Button
MsgBox(0, '', 'OK')
EndSwitch
WEnd