# SimConnect_SubscribeInputEvent The **SimConnect\_SubscribeInputEvent** function is used to subscribe an input event and generate when the value changes.   ##### Syntax ``` cpp HRESULT SimConnect_SubscribeInputEvent( HANDLE hSimConnect, UINT64 Hash, ) ```   ##### Parameters {{< table-wrapper >}} | Parameter | Description | Type | |---------------|----------------------------------------------------------------------------------------------------------------------------|---------| | `hSimConnect` | Handle to a SimConnect object. | Integer | | `Hash` | Hash ID that will identify the desired input event to subscribe to. You can use 0 here to subscribe to *all* input events. | Integer | {{< /table-wrapper >}}   ##### Return Values The function returns an **HRESULT**. Possible values include, but are not limited to, those in the following table. {{< table-wrapper >}} | Return value | Description | |--------------|-------------------------| | S\_OK | The function succeeded. | | E\_FAIL | The function failed. | {{< /table-wrapper >}}   This function might throw one of the following `SIMCONNECT_EXCEPTION`: - `SIMCONNECT_EXCEPTION_ERROR` in case of internal errors - `SIMCONNECT_EXCEPTION_GET_INPUT_EVENT_FAILED` if the given hash in wrong   ##### Remarks This function will subscribe to a specific input event based on the given hash (you can retrieve the input event hashes using [`SimConnect_EnumerateInputEvents`](simconnect-enumerateinputevents/)). You may also supply 0 (null) as the hash value, in which case you will be subscribing to *all* input events. The function will generate one or more [`SIMCONNECT_RECV_SUBSCRIBE_INPUT_EVENT`](../structures-and-enumerations/simconnect-recv-subscribe-input-event/) structs. {{< callout context="note" title="NOTE" icon="outline/bulb" >}} If you are using C\# please see the [Note for C\#](simconnect-getinputevent/#note). {{< /callout >}}