How do I develop C++Builder applications that manage conversations?
Last reviewed: 3/4/2013
HOW Article ID: H031301
The information in this article applies to:
- VoiceXMLKit
Summary
You can develop C++Builder applications that manage conversations using your favorite version of C++Builder.
More Information
VoiceXMLKit includes C++Builder header files comprised of the C++Builder classes that manage conversations and automatically load and unload the runtime DLL.
To access the VoiceXMLKit C++Builder classes within your application, first add a project reference to the C++Builder header include files:
- Within your C++Builder project, select Project Options.
- Select the C++Builder compiler options.
- Add Include path reference to the VoiceXMLKit header files directory: C:\Program Files\Chant\VoiceXMLKit\Win32\CBuilder\include.
- Within your C++Builder project, select Project Options.
- Select the C++Builder compiler options.
- Add Include path reference to the VoiceXMLKit header files directory: C:\Program Files\Chant\VoiceXMLKit\Win64\CBuilder\include.
To access the VoiceXMLKit C++Builder classes within your application, add a reference to the VoiceXMLKit Header file in your C++Builder application header file:
#include "cchantxm.h"
Add a reference in your C++Builder 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:
void __fastcall OnHasEvent(TMessage& msg);
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_APP+9, TMessage, OnHasEvent);
END_MESSAGE_MAP(TForm)
private:
// User declarations
CChantXM* ChantXM1;
Add the following to your application source file:
ChantXM1 = new CChantXM();
// Set deployment license properties
ChantXM1->SetStringProperty(CSPLicense,"LicenseRegistrationNumber");
ChantXM1->SetStringProperty(CSPSerials,"LicenseSerialNumber");
// Define the HasEvent callback message
ChantXM1->SetWindowMessage(Handle, WM_APP+9, 0, 0);
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.
void __fastcall TForm1::OnHasEvent(TMessage& msg)
{
int numberOfEvents = ChantXM1->GetResourceCount(CSREvent,0,0);
for (int i = 0; i < numberOfEvents; i++)
{
// Get the event from the event queue
CChantXMEvent* pEvent = ChantXM1->GetChantXMEvent(0);
switch (pEvent->GetChantCallback())
{
default:
break;
case CCXMCompileDone:
{
...
break;
}
case CCXMCompileError:
{
...
break;
}
}
...
// Remove the event from the event queue
ChantXM1->RemoveResource(CSREvent,0,0);
delete pEvent;
}
}
Deployment Checklist
When you are ready to deploy your C++Builder 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++Builder 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++Builder 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
C++Builder sample projects are installed at the following location:
- My Documents\Chant VoiceXMLKit\Win32\CBuilder\RS 2009,
- My Documents\Chant VoiceXMLKit\Win32\CBuilder\RS 2010,
- My Documents\Chant VoiceXMLKit\Win32\CBuilder\RS XE,
- My Documents\Chant VoiceXMLKit\Win32\CBuilder\RS XE2, and
- My Documents\Chant VoiceXMLKit\Win32\CBuilder\RS XE3.
- My Documents\Chant VoiceXMLKit\Win64\CBuilder\RS XE3.
For additional help with VoiceXMLKit, contact Chant Support via or web.