Kinect for Windows 1.5, 1.6, 1.7, 1.8

Creates an instance of the Kinect sensor with the specified index so that an application can open and use it.

HRESULT NuiCreateSensorByIndex(
         int index,
         INuiSensor **ppNuiSensor


Type: int
[in] The zero-based index of the Kinect sensor to open. Valid values range from zero to one less than the value returned by the NuiGetSensorCount function.
Type: INuiSensor
[out] A pointer that receives a reference to the created INuiSensor interface.

Return Value

Returns S_OK if successful; otherwise, returns one of the failure codes in the following table.
E_OUTOFMEMORYThe allocation failed.
E_POINTERThe hNextFrameEvent parameter is an invalid handle.

This function supports applications that use more than one Kinect sensor. Applications that use only one sensor do not need an INuiSensor interface, and should use the functions in NuiApi.h, NuiImageCamera.h, and NuiSkeleton.h.

Applications that support more than one Kinect sensor call NuiCreateSensorByIndex to access the second and subsequent devices. This function returns a pointer to an INuiSensor interface, which provides functions that are identical to those in NuiApi.h, NuiImageCamera.h, and NuiSkeleton.h, but operate on a particular device instance.

Header: Declared in NuiSensor.h; however, include NuiApi.h in your project.

Community Additions