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

# IXtfInputClient::DisconnectGamepad Method

> IXtfInputClient::DisconnectGamepad Method

# IXtfInputClient::DisconnectGamepad Method

Disconnects a specified virtual controller.

<a id="syntaxSection" />

## Syntax

```cpp theme={null}
public:
HRESULT DisconnectGamepad(
         UINT64 controllerId
)  
```

<a id="ID4EG" />

### Parameters

*controllerId*\
Type: UINT64

The device identifier of this [IXtfInputClient](/reference/tools/xtf/xtfinput/classes/IXtfInputClient/ixtfinputclient-xtfinput-xbox-windows-t).

<a id="ID4EP" />

### Return value

Type: HRESULT

HRESULT success or error code.

<a id="remarks" />

## Remarks

Call **DisconnectGamepad** when virtual controller operations are complete, to ensure that resources allocated for the virtual controller are freed. Every call to [IXtfInputClient::ConnectGamepad](/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/connectgamepad-ixtfinputclient-xtfinput-xbox-windows-m) should be paired with a call to **DisconnectGamepad**. Failure to disconnect a created gamepad will result in a memory leak. You may call [IXtfInputClient::DisconnectAllGamepads](/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/disconnectgamepad-ixtfinputclient-xtfinput-xbox-windows-m) to ensure that all virtual controllers are disconnected in order to avoid a memory leak.

<a id="requirements" />

## Requirements

**Header:** xtfinput.h

**Library:** xtfinput.lib

**Supported platforms:** Windows (for XBOX console tools)

## See also

[XtfInput](/reference/tools/xtf/xtfinput/xtfinput-xbox-microsoft-n)\
[IXtfInputClient](/reference/tools/xtf/xtfinput/classes/IXtfInputClient/ixtfinputclient-xtfinput-xbox-windows-t)\
[IXtfInputClient::ConnectGamepad](/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/connectgamepad-ixtfinputclient-xtfinput-xbox-windows-m)\
[IXtfInputClient::DisconnectAllGamepads](/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/disconnectgamepad-ixtfinputclient-xtfinput-xbox-windows-m)


## Related topics

- [IXtfInputClient::DisconnectAllGamepads Method](/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/disconnectallgamepads-ixtfinputclient-xtfinput-xbox-windows-m.md)
- [IXtfInputClient::ConnectGamepad Method](/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/connectgamepad-ixtfinputclient-xtfinput-xbox-windows-m.md)
- [IXtfInputClient::SendGamepadReport Method](/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/sendgamepadreport-ixtfinputclient-xtfinput-xbox-windows-m.md)
- [IXtfInputClient::SendGamepadReportEx](/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/ixtfinputclient_sendgamepadreportex.md)
- [IXtfInputClient::SendGamepadReportWithAudio](/reference/tools/xtf/xtfinput/classes/IXtfInputClient/methods/ixtfinputclient_sendgamepadreportwithaudio.md)
