Share via


NuiCreateSensorById

Kinect for Windows 1.5, 1.6, 1.7, 1.8

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

Syntax

HRESULT NuiCreateSensorById(
         const OLECHAR *strInstanceId,
         INuiSensor **ppNuiSensor
)

Parameters

  • strInstanceId
    Type: OLECHAR
    [in] A pointer to the ID of the Kinect to open.
  • ppNuiSensor
    Type: INuiSensor
    [out] A pointer that receives a reference to the created INuiSensor interface.

Return Value

Type: HRESULT
Returns S_OK if successful; otherwise, returns one of the failure codes in the following table.

Error Description
E_OUTOFMEMORY The allocation failed.
E_POINTER The hNextFrameEvent parameter is an invalid handle.

Remarks

Note

This function supports applications that use more than one Kinect. 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 call NuiCreateSensorById 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.

Requirements

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