Developing Microsoft Visual C++ applications that manage conversations

Last reviewed: 3/4/2013

HOW Article ID: H031304

The information in this article applies to:

  • VoiceXMLKit

Summary

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

More Information

VoiceXMLKit includes C++ header files comprised of the C++ classes that manage conversations and automatically load and unload the runtime DLL.

To access the VoiceXMLKit 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 VoiceXMLKit header files: C:\Program Files\Chant\VoiceXMLKit\Win32\CDLL\include.
  5. Press the Apply button to save changes and dismiss the Project Properties.
  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 VoiceXMLKit header files: C:\Program Files\Chant\VoiceXMLKit\Win64\CDLL\include.
  5. Press the Apply button to save changes and dismiss the Project Properties.

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


#include "cchantxm.h"

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


#include "CChantVoiceXMLKit.cpp"

Object Instantiation

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

Add the following to your application header file:


protected:
CChantXM* m_pChantXM;  // ChantXM object
virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);

Add the following to your application source file:


// Instantiate ChantXM object
m_pChantXM = new CChantXM();

// Set license properties
m_pChantXM->SetStringProperty(CSPLicense,L"LicenseRegistrationNumber");
m_pChantXM->SetStringProperty(CSPSerials,L"LicenseSerialNumber");

// Define the HasEvent callback message
m_HasEvent = WM_APP+9;
m_pChantXM->SetWindowMessage(GetSafeHwnd(),m_HasEvent);  

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_pChantXM != NULL)
    {	
        if (message == m_HasEvent)
        {
            // Get the number of events
            int numberOfEvents = m_pChantXM->GetResourceCount(CSREvent, 0, 0);
            for (int i = 0; i < numberOfEvents; i++)
            {
                // Get the event from the event queue
                CChantXMEvent* pChantXMEvent = m_pChantXM->GetChantXMEvent(0);
                switch (pChantXMEvent->GetChantCallback())
                {
                    case CCXMCompileDone:
                    {
                        ...
                        break;
                    }
                    case CCXMCompileError:
                    {
                        ...
                        break;
                    }
                    default:
                        break;
                }

                ...

                // Remove the event from the event queue
                m_pChantXM->RemoveResource(CSREvent, 0);
                // Delete the C++ wrapper class object
                delete pChantXMEvent;
                pChantXMEvent = 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 CVoiceXMLKit.dll to the target system and place in the same directory with your application.
  • You may deploy your C++ application to any system with a valid license from the Chant.
  • Copy CVoiceXMLKitX64.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 VoiceXMLKit\Win32\CDLL\VS 2010 and
  • My Documents\Chant VoiceXMLKit\Win32\CDLL\VS 2012.
  • My Documents\Chant VoiceXMLKit\Win64\CDLL\VS 2010 and
  • My Documents\Chant VoiceXMLKit\Win64\CDLL\VS 2012.

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