Cisco Cisco Computer Telephony Integration Option 8.5 Developer's Guide

Page of 490
   
4-12
CTI OS Developer’s Guide for Cisco Unified Contact Center Enterprise
Release 8.5(3)
Chapter 4      Building Your Application
Using the COM CIL in Visual C++ 8.0(1)
Building a custom Win32 (Console or Windows) CTI application in Visual C++ 8.0(1) with COM 
requires knowledge of creating and using COM components in Microsoft Visual C++ 8.0(1). Client 
applications of this type tend to be more complex to build, and more powerful and faster in execution, 
than scripting clients (for example, Visual Basic). All the CIL components for COM are distributed as 
COM Dynamic Link Libraries (COM DLL). 
COM components must be registered with Windows to be accessible to COM containers including 
Microsoft Visual C++ 8.0(1). The components required for programming in Microsoft Visual C++ 8.0(1) 
are:
CTI OS Client library (CTIOSClient.dll). This is the main CIL library for COM. The objects 
available in this library are described fully in Chapters 8 through 11.
CTI OS Arguments Library (arguments.dll). The Arguments helper class is used extensively in 
CTI OS, and is described fully in 
CTI OS Session Resolver (ctiossessionresolver.dll). This object allows multiple applications or 
controls to use a single CTI OS Session object. It is required when building an application that 
includes the CTI OS ActiveX controls.
Adding COM Support to your Application
Your application must support COM to use these objects in your CTI application. To add COM support 
to your application, you must use one of the following:
Microsoft Foundation Classes (MFC). The following header files are required for MFC applications 
to use COM: afxwin.hafxext.hafxdisp.h, and afxdtctl.h. If you build an application using the 
Microsoft Visual C++ 7.1(1) application wizard, these files are included automatically.
Microsoft’s ActiveX Template Library (ATL). To use ATL, include the standard COM header file: 
atlbase.h
Important Note About COM Method Syntax
In this manual, the syntax used to describe method calls in COM shows standard COM data types such 
as BSTR, VARIANT and SAFEARRAY. Be aware that these data types can be encapsulated by wrapper 
classes proper to the environment depending on the development environment, tools, and how the COM 
CIL is included in your project application. 
For example, in a Microsoft Visual C++ 7.1(1) project a VARIANT type can be either a CComVariant 
or _variant_t, and a BSTR type can be either a CComBSTR or _bstr_t.
For more information, see the documentation for your development environment.
Using the CIL Dynamic Link Libraries
Next, you must import the COM Dynamic Link Libraries into your C++ application. The following code 
sample (which you might put into your StdAfx.h file) depicts how to use a COM Dynamic Link Library 
in C++:
#import "..\..\Distribution\COM\ctiossessionresolver.dll" using namespace 
CTIOSSESSIONRESOLVERLib;
#import "..\..\Distribution\COM\ctiosclient.dll" using namespace CTIOSCLIENTLib;