Extensibility > CtAPI > Function Reference > ctOpenEx

ctOpenEx

Establishes the connection to the CtAPI server using the given client instance. Create the client instance prior to calling ctOpenEx, using the function ctClientCreate.

ctOpenEx provides exactly the same connection functionality as ctOpen, the only difference being that ctOpen also creates the CtAPI client instance. See ctOpen for details on the connection mechanism and the parameters involved.

Syntax

ctOpenEx(sComputer, sUser, sPassword, nMode, hCTAPI);

sComputer

Type: LPCSTR
Input/output: Input
Description: The computer you want to communicate with via CTAPI. For a local connection, specify NULL as the computer name. The Windows Computer Name is the name as specified in the Identification tab, under the Network section of the Windows Control Panel.

sUser

Type: LPCSTR
Input/output: Input
Description: Your username as defined in the Citect SCADA project running on the computer you want to connect to. This argument is only necessary if you are calling this function from a remote computer. On a local computer, it is optional.

sPassword

Type: LPCSTR
Input/output: Input
Description: Your password as defined in the Citect SCADA project running on the computer you want to connect to. This argument is only necessary if you are calling this function from a remote computer. You need to use a non-blank password. On a local computer, it is optional.

nMode

Type: Dword
Input/output: Input
Description:The mode of the Cicode call. Set this to 0 (zero).

hCTAPI

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

Return Value

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

Related Functions

ctClientCreate, ctOpen, ctClose, ctCloseEx, ctClientDestroy

Example

See ctClientCreate

Published June 2018