INuiSensor::NuiSetFrameEndEvent Method

Kinect for Windows 1.5, 1.6, 1.7, 1.8

Sets the event that signals the last frame.

HRESULT NuiSetFrameEndEvent(
         HANDLE hEvent,
         DWORD dwFrameEventFlag


[in] A handle to the event.
[in] Specifies the frame event options, as a bitwise-OR combination of the NUI_IMAGE_STREAM_FLAG constants.

Return Value

Returns S_OK if successful; otherwise, returns one of the failure codes in the following table.
E_INVALIDARGThe hEvent parameter is an invalid handle.

If the frame does not contain any data to process, the event is still signaled unless you specify otherwise by setting dwFrameEventFlag to NUI_FRAME_EVENT_FLAG_SUPPRESS_NO_FRAME_DATA.

The event provided is signaled after the Kinect runtime has completed the processing of the data associated with a frame. When you use NuiImageStreamGetNextFrame and NuiSkeletonGetNextFrame, the stream data generated in that frame is available before the event is signaled.

This event is never reset by the Kinect runtime. A correct operation requires an auto-reset, instead of a manual reset event.

When designing your application, follow these guidelines.
  • Processing multiple streams in a single thread. You must use a NuiSetFrameEndEvent event instead of distinct per-stream events. The flag NUI_FRAME_EVENT_FLAG_SUPPRESS_NO_FRAME_DATA still applies on a per-stream basis when you call NuiImageStreamGetNextFrame. This is if, in NuiImageStreamOpen, you specify NUI_IMAGE_STREAM_FLAG_SUPPRESS_NO_FRAME_DATA for the stream.
  • Processing multiple streams in multiple threads. For efficiency reasons, you must create a distinct event for each stream instead of using NuiSetFrameEndEvent. This ensures that your application doesn't have to wait until the processing of skeleton tracking is completed before it can obtain color and depth data.
  • Signaling when skeleton data is available. Use an event in NuiSkeletonTrackingEnable.
  • Signaling when an image stream is available. Use an event in NuiImageStreamOpen.

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

Community Additions