#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$hGUI = GUICreate('StaticButton')
$iButton = GUICtrlCreateLabel('Я кнопка - нажми меня', 10, 10, 200, 30, BitOR($WS_BORDER, $SS_CENTER, $SS_CENTERIMAGE))
GUISetState()
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $iButton
Do
$aInfo = GUIGetCursorInfo($hGUI)
Until Not $aInfo[2]
If $aInfo[4] = $iButton Then
MsgBox(0, 'Я кнопка', 'Меня нажали :(', 0, $hGUI)
EndIf
EndSwitch
WEnd