Technical Reference > CtAPI Functions > Function Reference > ctCloseEx


Closes the connection to the CtAPI server for the given CtAPI instance. It closes the connection the same way as does the ctClose method, but provides an option for whether or not to destroy the CtAPI instance within the ctCloseEx function call. ctClose always destroys the CtAPI instance within its function call.

For example, consider a situation where when we try to close the connection to the CtAPI server and it takes a long time to respond (or doesn't at all). If you call ctClose, you can't cancel the ctClose by calling ctCancelIO because you can't guarentee that the CtAPI instance is not in the process of being destroyed. But if you call ctCloseEx with the option of not destroying the CtAPI instance, you can call ctCancelIO to cancel the ctCloseEx.

When you call ctCloseEx with bDestroy equal to FALSE, you need to then call ctClientDestroy afterwards to free the CtAPI client instance.




Type: Handle
Input/output: Input
Description: The handle to the CTAPI as returned from ctOpen().


Type: boolean
Input/output: Input
Description: If TRUE will destroy the CtAPI instance within the ctCloseEx function call. Default is FALSE.

Return Value

TRUE if successful, otherwise FALSE. Use GetLastError() to get extended error information.

Related Functions

ctClientDestroy, ctClose, ctClientCreate, ctOpen, ctOpenEx


See ctClientCreate for an example.