#Include <ButtonConstants.au3>
#Include <GUIConstantsEx.au3>
#Include <WindowsConstants.au3>
$hForm = GUICreate('MyGUI', 300, 120)
$Button1 = GUICtrlCreateButton('OK', 40, 47, 100, 27, $BS_NOTIFY)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
$Button2 = GUICtrlCreateButton('Cancel', 160, 47, 100, 27, $BS_NOTIFY)
$Label = GUICtrlCreateLabel('555', 10, 98, 200, 14)
GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND')
GUISetState()
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
MsgBox(0, '', 'Какое-нибудь сообщение.')
Case $Button2
MsgBox(0, '', 'Еще одно какое-нибудь сообщение.')
EndSwitch
WEnd
Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
Switch $hWnd
Case $hForm
Switch BitShift($wParam, 16)
Case $BN_SETFOCUS
Switch BitAND($wParam, 0xFFFF)
Case $Button1
GUICtrlSetData($Label, 'Set focus to "OK" button')
Case $Button2
GUICtrlSetData($Label, 'Set focus to "Cancel" button')
EndSwitch
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND