#include <WinAPI.au3>
#include <GUIConstantsEx.au3>

_Main()

Func _Main()
	Local $btnFocus, $win, $text
	GUICreate("Пример", 200, 200)
	$btnFocus = GUICtrlCreateButton("Получить фокус", 50, 85, 100, 30)
	GUISetState()
	While 1
		Switch GUIGetMsg()
			Case $GUI_EVENT_CLOSE
				Exit
			Case $btnFocus
				$win = _WinAPI_GetFocus()
				$text = "Заголовок: " & WinGetTitle($win) & @LF
				$text &= "Текст: " & WinGetText($win) & @LF
				$text &= "Дескриптор: " & WinGetHandle($win) & @LF
				$text &= "Процесс: " & WinGetProcess($win) & @LF
				MsgBox(4096, "", $text)
		EndSwitch
	WEnd
EndFunc   ;==>_Main