> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# IGameInputReading::GetSystemButtonState

> Retrieves the state of the system buttons, such as the Guide and Share buttons, from an input reading.

Retrieves the state of the system buttons, such as the Guide and Share buttons, from an input reading.

## Syntax

```cpp theme={null}
bool GetSystemButtonState(
    GameInputSystemButtons* buttons
);
```

### Parameters

*buttons*   \_Out\_\
Type: [GameInputSystemButtons](https://docs.xbox.com/reference/input/gameinput/enums/gameinputsystembuttons.md)\*

Receives the set of system buttons that are pressed in this reading.

### Return value

Type: bool

Returns `true` if the reading contains system button state. Returns `false` if it doesn't, in which case *buttons* is set to `GameInputSystemButtonNone`.

## Remarks

In GameInput v4, system buttons are an ordinary input kind, `GameInputKindSystemButton`. Every reading from a device that has system buttons includes `GameInputKindSystemButton` in [IGameInputReading::GetInputKind](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getinputkind.md), and `GetSystemButtonState` returns the current state of those buttons in the same way that [IGameInputReading::GetGamepadState](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getgamepadstate.md) returns the state of the gamepad buttons. To find out which system buttons a device has, call [IGameInputDevice::GetSupportedSystemButtons](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedsystembuttons.md).

The reading reports which buttons are pressed, not press or release events. To detect a press or a release, compare the state with the state from the previous reading.

This method replaces the [IGameInput::RegisterSystemButtonCallback](https://docs.xbox.com/reference/input/gameinput/deprecated/interfaces/igameinput/methods/igameinput_registersystembuttoncallback.md) method from earlier versions of GameInput. Use [IGameInput::RegisterReadingCallback](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinput/methods/igameinput_registerreadingcallback.md) with `GameInputKindSystemButton`, or poll with [IGameInput::GetCurrentReading](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinput/methods/igameinput_getcurrentreading.md), to receive system button input.

System button input is delivered only while the application has focus, unless background input is enabled with [IGameInput::EnableBackgroundInput](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinput/methods/igameinput_enablebackgroundinput.md).

The following example shows how to detect a new press of the Guide button.

```cpp theme={null}
Microsoft::WRL::ComPtr<IGameInput> gameInput;
GameInputSystemButtons previousButtons = GameInputSystemButtonNone;

void PollGuideButton() noexcept
{
    Microsoft::WRL::ComPtr<IGameInputReading> reading;
    if (SUCCEEDED(gameInput->GetCurrentReading(GameInputKindSystemButton, nullptr, &reading)))
    {
        GameInputSystemButtons buttons = GameInputSystemButtonNone;
        if (reading->GetSystemButtonState(&buttons))
        {
            const bool guidePressed = (buttons & GameInputSystemButtonGuide) != 0;
            const bool guidePreviouslyPressed = (previousButtons & GameInputSystemButtonGuide) != 0;
            if (guidePressed && !guidePreviouslyPressed)
            {
                // Handle new Guide button press
            }

            previousButtons = buttons;
        }
    }
}
```

## Requirements

**Header:** GameInput.h

**Library:** gameinput.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## See also

[Overview of GameInput](https://docs.xbox.com/build/core-features/common/input/overviews/input-overview.md)\
[IGameInputReading](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputreading/igameinputreading.md)\
[GameInputSystemButtons](https://docs.xbox.com/reference/input/gameinput/enums/gameinputsystembuttons.md)\
[GameInputKind](https://docs.xbox.com/reference/input/gameinput/enums/gameinputkind.md)\
[IGameInput::EnableBackgroundInput](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinput/methods/igameinput_enablebackgroundinput.md)\
[IGameInputDevice::GetSupportedSystemButtons](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedsystembuttons.md)

## Version History

| Version | Changes |
| - | - |
| **v4** | Introduced. |


## Related topics

- [GameInputSystemButtons](https://docs.xbox.com/reference/input/gameinput/enums/gameinputsystembuttons.md)
- [IGameInputDevice::GetSupportedSystemButtons](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedsystembuttons.md)
- [RegisterSystemButtonCallback (Deprecated)](https://docs.xbox.com/reference/input/gameinput/deprecated/interfaces/igameinput/methods/igameinput_registersystembuttoncallback.md)
- [GameInputKind](https://docs.xbox.com/reference/input/gameinput/enums/gameinputkind.md)
- [GameInput API members](https://docs.xbox.com/reference/input/gameinput/gameinput_members.md)
