Ok, this one works with SciTE output as well (changed bit inside move func, also the call to move func, but as it is sending $aInfo[2] as activewin handle). If this helps maybe it can be improved.
Not quite right but better perhaps. Tested with:
1. SciTE main window
2. SciTE output
3. Notepad++
4. Windows Run menu (unintentional test while starting notepad )
5. Notepad
Still some issues with Excel, was better with earlier version.
;
; _WinAPI_GetGUIThreadInfo() Tests
;
; Demo 1, 2020-12-28, Professor Bernd.
;
; First test with the example from the AutoIt help for "_WinAPI_GetGUIThreadInfo()"
; looks good. I just changed the GUI to a non-focusable GUI without border, and
; added a button to close the GUI.
; There is no stealing of the focus and no eating of clicks or double clicks.
#include <GUIConstantsEx.au3>
#include <WinAPISysWin.au3>
#include <WindowsConstants.au3>
#include <WinAPIConv.au3>
; Local $hForm = GUICreate('', 240, 268, 10, 10, BitOR($WS_CAPTION, $WS_POPUP), $WS_EX_TOPMOST)
Global $hForm = GUICreate('', 260, 268, 10, 10, _
BitOR($WS_POPUP, $WS_BORDER), BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_NOACTIVATE))
Global $btnClose = GUICtrlCreateButton("X", 230, 10, 24, 24)
GUICtrlCreateLabel('Thread state:', 20, 18, 90, 14)
GUICtrlCreateLabel('Active window:', 20, 40, 90, 14)
GUICtrlCreateLabel('Keyboard focus:', 20, 62, 90, 14)
GUICtrlCreateLabel('Mouse capture:', 20, 84, 90, 14)
GUICtrlCreateLabel('Active menu:', 20, 106, 90, 14)
GUICtrlCreateLabel('Move or size loop:', 20, 128, 90, 14)
GUICtrlCreateLabel('Caret:', 20, 150, 90, 14)
GUICtrlCreateLabel('Left:', 20, 172, 90, 14)
GUICtrlCreateLabel('Top:', 20, 194, 90, 14)
GUICtrlCreateLabel('Width:', 20, 216, 90, 14)
GUICtrlCreateLabel('Height:', 20, 238, 90, 14)
Local $a_idInput[11]
For $i = 0 To 10
$a_idInput[$i] = GUICtrlCreateLabel('', 114, 18 + 22 * $i, 116, 14)
Next
GUISetState(@SW_SHOWNOACTIVATE)
Local $hWnd, $aInfo, $iPID
Do
$hWnd = WinGetHandle('[ACTIVE]')
$aInfo = _WinAPI_GetGUIThreadInfo(_WinAPI_GetWindowThreadProcessId($hWnd, $iPID))
If Not @error Then
WinSetTitle($hForm, '', WinGetTitle($hWnd))
$aInfo[0] = '0x' & Hex($aInfo[0], 8)
Else
WinSetTitle($hForm, '', '')
Dim $aInfo[11]
For $i = 0 To 10
$aInfo[$i] = ''
Next
$hWnd = 0
EndIf
For $i = 0 To 10
If StringCompare(GUICtrlRead($a_idInput[$i]), $aInfo[$i]) Then
GUICtrlSetData($a_idInput[$i], $aInfo[$i])
EndIf
Next
MoveMyForm($hWnd, $aInfo[2], $aInfo[2], $aInfo[7], $aInfo[8])
Until GUIGetMsg() = $btnClose
Func MoveMyForm($_hWnd, $_ActiveWin, $_ActiveCtrl, $_iX, $_iY)
Local $aPos = WinGetPos($_ActiveWin)
Local $iX = ($aPos="") ? (0):($aPos[0])
Local $iY = ($aPos="") ? (0):($aPos[1])
Local $tPoint = DllStructCreate("int X;int Y")
DllStructSetData($tPoint, "X", $_iX + $iX)
DllStructSetData($tPoint, "Y", $_iY + $iY)
_WinAPI_ClientToScreen(_WinAPI_GetTopWindow ( $_ActiveWin ), $tPoint)
WinMove($hForm, "", DllStructGetData($tPoint, "X"), DllStructGetData($tPoint, "Y"))
EndFunc