Cisco Cisco Computer Telephony Integration Option 9.0 Developer's Guide

Page of 500
   
3-7
CTI OS Developer’s Guide for Cisco Unified ICM/Contact Center Enterprise & Hosted
Release 7.5(1)
Chapter 3      CIL Coding Conventions
COM Error Codes
Note
If a method that is supposed to trigger an event returns an error code, you need to check this return value 
before continuing to wait for events. Depending on the error code, the event you were waiting for may 
not be triggered.
COM Error Codes
For applications using the CTI OS CIL for COM, the Microsoft COM layer adds a level of error detection 
and provides additional error codes, called HRESULTs. For COM method calls in C++, the HRESULT 
is returned from the method call, and indicates success or failure of the method call. The CIL error code 
is also returned, but as an [out, retval] parameter. For example:
// COM Example in C++
int errorCode = 0;
HRESULT hr = pCall->Answer(&errorCode);
if (errorCode=CIL_FAILED)
printf(“An error has occurred while answering the call.”)
In Visual Basic, HRESULT values are hidden under the covers. When an error occurs, a Visual Basic 
exception is thrown, which can be caught using the On Error: construct. The CIL error code is returned 
as the result of the method call:
‘ VB example:
On Error GoTo Error_handler
Dim errorCode as Long
ErrorCode = pCall.Answer
If ErrorCode = CIL_FAILED
Debug.print “An error has occurred.”
The complete set of HRESULT values is defined by Microsoft in the header file winerror.h. The most 
common HRESULT values that might be seen by CTI OS developers are listed in 
:
Generic Interfaces 
One of the main design goals of CTI OS was to enable future enhancements to the CTI OS feature set 
without breaking existing interfaces. To accomplish this, a parameter for almost every method and event 
will be an Arguments array containing the actual parameters needed. Therefore, parameters may be 
added or deleted in future versions without affecting the signature of the method or event. This provides 
the benefit to developers that code developed to work with one version of the CTI OS developer’s toolkit 
Table 3-3
COM Error Codes
COM Error Code
Numeric Value
Description
S_OK
0x00000000
The method succeeded.
S_FALSE
0x00000001
The method succeeded, but something 
unusual happened.
E_FAILED
0x80000008
The method failed.
REG_DB_E_ 
CLASSNOTREG
0x80040143
The class was not found in the registry. 
You will need to run regsvr32.exe on the 
DLL file to register it.