Partager via


IXtfInputClient::ConnectGamepad Method

Creates a virtual controller, and gets the device identifier for it.

Syntax

public:
HRESULT ConnectGamepad(
         UINT64 *pControllerId
)  

Parameters

pControllerId
Type: UINT64 *

Pointer to a UINT64 that receives the device identifier of this IXtfInputClient.

Return value

Type: HRESULT

HRESULT success or error code.

Remarks

ConnectGamepad allocates system resources for each virtual controller created, as well as returns the identifier for the virtual controller that will be used to send input to a development console with IXtfInputClient::SendGamepadReport. Your code should wait 2 seconds after calling ConnectGamepad before calling SendGamepadReport, to ensure that the console has finished registering the new controller and is ready to accept input. Your code should always pair a call to ConnectGamepad with a call to DisconnectGamepad to ensure that these system resources are freed for reuse. You may also call IXtfInputClient::DisconnectAllGamepads to release all of the virtual controller resources at once.

Requirements

Header: xtfinput.h

Library: xtfinput.lib

Supported platforms: Windows (for Xbox console tools)

See also

XtfInput
IXtfInputClient
IXtfInputClient::ConnectGamepad
IXtfInputClient::DisconnectGamepad
IXtfInputClient::DisconnectAllGamepads