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

$hGui = GUICreate('CreateWindowEx', 230, 60)
Global $hHotkey = _WinAPI_CreateWindowEx(0, "msctls_hotkey32", "", BitOR($WS_CHILD, $WS_VISIBLE, $WS_TABSTOP), 10, 10, 140, 22, $hGui)
Global $hButton = _WinAPI_CreateWindowEx(0, "Button", "Тест", BitOR($WS_CHILD, $WS_VISIBLE, $WS_TABSTOP), 160, 10, 60, 22, $hGui)
$iStatusBar = GUICtrlCreateLabel('Строка состояния', 5, 60 - 20, 300 - 10, 17)
GUISetState()
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

While 1
	Switch GUIGetMsg()
		Case $GUI_EVENT_CLOSE
			_WinAPI_DestroyWindow($hHotkey)
			_WinAPI_DestroyWindow($hButton)
			GUIDelete($hGui)
			Exit
	EndSwitch
WEnd

Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
	Local $nID = BitAND($wParam, 0x0000FFFF) ; _WinAPI_LoWord
	Local $nNotifyCode = BitShift($wParam, 16) ; _WinAPI_HiWord

	Switch $lParam
		Case $hButton
			Switch $nNotifyCode
				Case $BN_CLICKED
					$iRet = _SendMessage($hHotkey, $WM_USER + 2, 0, 0)
					If $iRet Then
						GUICtrlSetData($iStatusBar, 'Модификатор = ' & BitShift($iRet, 8) & ', клавиша = ' & BitAND($iRet, 0xFF))
					Else
						GUICtrlSetData($iStatusBar, 'Нет')
					EndIf
					_WinAPI_SetFocus($hHotkey)
			EndSwitch
	EndSwitch
	Return $GUI_RUNDEFMSG
EndFunc