Developing Microsoft Visual C++ applications that manage movement

Last reviewed: 10/4/2012

HOW Article ID: H101204

The information in this article applies to:

  • KinectKit


You can develop Microsoft Visual C++ applications that manage Kinect sensors using your favorite version of Microsoft Visual C++.

More Information

KinectKit includes C++ header files comprised of the C++ classes that manage Kinect sensors and automatically load and unload the runtime DLL.

To access the KinectKit C++ classes within your application, first add a project reference to the C++ header include files:

  1. Within your C++ project, select Project Properties.
  2. Under Configuration Properties, expand the C++ Properties and select the General Settings.
  3. Edit the Additional Include Directories.
  4. Locate the include directory path of the KinectKit header files: C:\Program Files\Chant\KinectKit\Win32\CDLL\include.
  5. Press the Apply button to save changes and dismiss the Project Properties.

To access the KinectKit C++ classes within your application, add a reference to the KinectKit Header file in your C++ application header file:

#include "cchantkm.h"

Add a reference in your C++ application source file to the KinectKit code needed to dynamically load and unload the runtime DLL:

#include "CChantKinectKit.cpp"

Object Instantiation

Declare a global variable for the ChantKM class, instantiate an instance, set the license and serial properties, and set the event handler message.

Add the following to your application header file:

    CChantKM* m_pChantKM;  // ChantKM object
    virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);

Add the following to your application source file:

    // Instantiate ChantKM object
    m_pChantKM = new CChantKM();

    // Set license properties

    // Define the HasEvent callback message
    m_HasEvent = WM_APP+8;

Event Callbacks

Event callbacks are the mechanism in which the component library communications information back to the application such as compilation is complete or there was an error.

LRESULT CKinectSensorDlg::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
    // TODO: Add your specialized code here and/or call the base class
    if (m_pChantKM != NULL)
        if (message == m_HasEvent)
            // Get the number of events
            int numberOfEvents = m_pChantKM->GetResourceCount(CSREvent, 0, 0);
            for (int i = 0; i < numberOfEvents; i++)
                // Get the event from the event queue
                CChantKMEvent* pChantKMEvent = m_pChantKM->GetChantKMEvent(0);
                switch (pChantKMEvent->GetChantCallback())
                    case CCKSStatusChanged:




                // Remove the event from the event queue
                m_pChantKM->RemoveResource(CSREvent, 0);
                // Delete the C++ wrapper class object
                delete pChantKMEvent;
                pChantKMEvent = NULL;
    return CDialog::DefWindowProc(message, wParam, lParam);

Deployment Checklist

When you are ready to deploy your C++ application, you need to ensure you have a valid license, bundle the correct Chant component library, and configure your installation properly on the target system. Review the following checklist before deploying your applications:

  • You may deploy your C++ application to any system with a valid license from the Chant.
  • Copy CKinectKit.dll to the target system and place in the same directory with your application.

Sample Projects

Microsoft Visual C++ sample projects are installed at the following location:

  • My Documents\Chant KinectKit\Win32\CDLL\VS 2010 and
  • My Documents\Chant KinectKit\Win32\CDLL\VS 2012.

For additional help with KinectKit, contact Chant Support via Chant Support Contacts or web.