;-- TIME_STAMP   2018-01-08 19:55:52

#include <Array.au3>
#include <WinGetControls.au3>

_Example1()
_Example2()

#cs	_WinGetControls($hWnd [, $iVisible = $WGC_SHOWVISIBLE] [, $bProcessInfo = True] [, $bExtended = False])

	Diese Variablen sind in _WinGetControls.au3 deklariert und hier nur zur Übersicht aufgeführt!
	Global $sHeader_ProcessInfo = 'iCount|iPID|sProcessName|sCommandLine|sUser|bWow64|sWorkingDir|sRunTime|iPIDParentProcess|sParentProcessName|aParentProcessWindows|aProcessList'
	Global $sHeader_Controls = 'HWND|CLASS|NN|ID|AU3|Visible|xPos|yPos|width|hight|Title|Text'
	Global Enum $eHWND, $eCLASS, $eNN, $eID, $eAU3, $eVisible, $exPos, $eyPos, $ewidth, $ehight, $eTitle, $eText
	Global Enum $eName, $eErw, $eSize, $eDatum, $eAttr
#ce
Func _Example1()
	Local $bProcessInfo = True, $bExtended = False ; auch Inhalt von LV usw. holen
	Local $aControls = _WinGetControls(WinGetHandle('[Active]'), 0, False, True)
	If $bProcessInfo And $aControls[0][1] Then
		Local $aHeader = StringSplit($sHeader_ProcessInfo, '|', 2), $sProcessInfo
		For $i = 0 To UBound($aControls, 2) -1 Step 1
			$sProcessInfo = $aControls[0][$i]
			If IsArray($sProcessInfo) Then $sProcessInfo = StringReplace(_ArrayToString($sProcessInfo, ', '), @CRLF, ' | ')
		Next
	EndIf
	_ArrayDisplay($aControls, '$aControls', '', 0, Default, $sHeader_Controls)
EndFunc

#cs *******************************************************************************************************************************************************
	$bProcessInfo nur dann auf True setzen, wenn Infos für ein einzelnes Top-Window geholt wird, anderfalls werden Inhalte in $aAllWindows überschrieben!!!
#ce	*******************************************************************************************************************************************************
Func _Example2()
	Local $l, $aAllWindows[0][12], $aTopWindows = _WinAPI_EnumWindowsTop(), $aControls, $bProcessInfo = False, $bExtended = False ; auch Inhalt von LV usw. holen
	_ArrayDisplay($aTopWindows, '$aTopWindows')
	For $i = 1 To $aTopWindows[0][0] Step 1
		$aControls = _WinGetControls($aTopWindows[$i][0], $WGC_SHOWVISIBLE, $bProcessInfo, $bExtended)
		If UBound($aControls) Then
			If Not Mod($i, 3) Then _ArrayDisplay($aControls, '$aControls', '', 0, Default, $sHeader_Controls) ; damit es nicht ermüdend wird...
			ReDim $aAllWindows[UBound($aAllWindows) + $aControls[0][0] + 3][12]
			$aAllWindows[$l][0] = $aTopWindows[$i][0]
			$aAllWindows[$l][1] = $aTopWindows[$i][1]
			$aAllWindows[$l][2] = 'TopWin'
			$l += 2
			For $j = 1 To $aControls[0][0] Step 1
;~ 				_ArrayDisplay($aAllWindows, '$aAllWindows', '', 0, Default, $sHeader_Controls)
				For $k = 0 To UBound($aControls, 2) -1 Step 1
					$aAllWindows[$l][$k] = $aControls[$j][$k]
				Next
				$l += 1
			Next
			$l += 1
;~ 			_ArrayDisplay($aAllWindows, '$aAllWindows', '', 0, Default, $sHeader_Controls)
		EndIf
	Next
	_ArrayDisplay($aAllWindows, '$aAllWindows', '', 0, Default, $sHeader_Controls)
EndFunc
