Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

ctClientCreate

  • Last UpdatedJul 13, 2023
  • 1 minute read

ctClientCreate initializes the resources for a new CtAPI client instance. Once you have called ctClientCreate, you can pass the handle returned to ctOpenEx to establish communication with the CtAPI server.

Consider a situation where you try to communicate to the CtAPI server and the server takes a long time to respond (or doesn't respond at all). If you just call , you haven't been given a handle to the CtAPI instance, so you can't cancel the ctOpen by calling ctCancelIO. But if you use ctClientCreate and then call ctOpenEx, you can use the handle returned by ctClientCreate to cancel the ctOpenEx.

Syntax

ctClientCreate()

Return Value

If the function succeeds, the return value specifies a handle. If the function does not succeed, the return value is NULL. Use GetLastError() to get extended error information.

ctOpen, ctOpenEx, ctClose, ctCloseEx, ctClientDestroy

Example

DWORD dwStatus = 0;

HANDLE hCtapi = ctClientCreate();

if (hCtapi == NULL) {

dwStatus = GetLastError(); // An error has occurred, trap it.

} else {

if (TRUE == ctOpenEx(NULL, NULL, NULL, 0, hCtapi)) {

ctTagWrite(hCtapi, "Fred", "1.5");

if (FALSE == ctCloseEx(hCtapi, FALSE)) {

dwStatus = GetLastError(); // An error has occurred, trap it.

}

} else {

dwStatus = GetLastError(); // An error has occurred, trap it.

}

if (FALSE == ctClientDestroy(hCtapi)) {

dwStatus = GetLastError(); // An error has occurred, trap it

}

}

In This Topic
TitleResults for “How to create a CRG?”Also Available in