Skip to main content
Gets an instance of the IGameInput interface for a specific GameInput API version.

Syntax

Parameters

riid   _In_
Type: REFIID
The interface ID (IID) of the IGameInput interface to get. The IID selects the GameInput API version, for example __uuidof(GameInput::v4::IGameInput) for v4 or __uuidof(GameInput::v0::IGameInput) for v0. ppv   _COM_Outptr_
Type: LPVOID*
Receives the requested interface of the underlying per-process singleton. Set to nullptr if the function fails.

Return value

Type: HRESULT Returns S_OK on success. Returns E_NOINTERFACE if riid isn’t the IID of an IGameInput interface, or if the installed GameInput runtime doesn’t support the requested API version. Returns another error code if the GameInput runtime can’t be loaded.

Remarks

GameInputInitialize works like GameInputCreate, but takes the IID of the IGameInput version that you want. Both functions return an interface on the same per-process singleton. The first call creates the singleton, and later calls add a reference to it. For guidance on when to call these functions and how long to keep the reference, see GameInputCreate. A GameInput runtime supports every API version that’s lower than or equal to its own major version. For example, the GameInput 4.0 runtime accepts the IID of any IGameInput version from v0 through v4. If you request a version that’s newer than the installed runtime, the function fails with E_NOINTERFACE. You can use this to check at run time whether a newer API version is available.

Relationship to GameInputCreate

Starting with v3, GameInputCreate in the GameInput header is an inline function that calls GameInputInitialize with the IID of the IGameInput interface that the header declares:
Because of this, calling GameInputCreate in v3 and later creates the version of IGameInput that matches the header you include. To create a different version without including its header, call GameInputInitialize directly. In v0, GameInputCreate is a function that’s exported by GameInput.lib and always creates the v0 interface. The GameInput.lib in the Microsoft.GameInput NuGet package exports GameInputInitialize instead. To create the v0 interface when you link that library, call GameInputInitialize with the v0 IID. The v0 header doesn’t declare GameInputInitialize, so declare it yourself:
If the installed runtime is too old to provide GameInputInitialize, the library falls back to the runtime’s GameInputCreate for the v0 IID, and returns E_NOINTERFACE for any other IID. To get another API version of an IGameInput object that you already have, call QueryInterface on it instead of calling GameInputInitialize again. For more information and examples, see Using multiple GameInput API versions in one application.

Requirements

Header: GameInput.h Library: GameInput.lib Supported platforms: Windows, XBOX One family consoles and XBOX Series consoles

See also

GameInputCreate
GameInput API versioning
Using multiple GameInput API versions in one application
GameInput

Version History

Last modified on November 5, 2026