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

$hGui = GUICreate('Моя программа', 350, 260)
$iButton = GUICtrlCreateButton('Тест', 10, 10, 160, 28)
$hButton = GUICtrlGetHandle(-1)
GUISetState()
While 1
	Switch GUIGetMsg()
		Case $iButton
			_WinAPI_SetWindowText($hButton, "Новый текст")
			_WinAPI_SetWindowText($hGui, "Новый текст заголовка")
		Case $GUI_EVENT_CLOSE
			Exit
	EndSwitch
WEnd