Extensibility > CtAPI > Function Reference > ctCancelIO

ctCancelIO

Cancels a pending overlapped I/O operation. When the I/O command is canceled, the event will be signaled to show that the command has completed. The status will be set to the Citect SCADA error ERROR CANCELED. If the command completes before you can cancel it, ctCancelIO() will return FALSE, and GetLastError() will return GENERIC_CANNOT_CANCEL. The status of the overlapped operation will be the completion status of the command.

The CTAPI interface will automatically cancel any pending I/O commands when you call ctClose().

Syntax

ctCancelIO(hCTAPI, pctOverlapped)

hCTAPI

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

pctOverlapped

Type: CTOVERLAPPED*
Input/output: Input
Description: Pointer to the overlapped I/O operation to cancel. If you specify NULL, any pending overlapped I/O operations on the interface will be canceled.

Return Value

If the function succeeds, the return value is TRUE. If the function does not succeed, the return value is FALSE. To get extended error information, call GetLastError.

Related Functions

ctOpen, ctClose

Example

char                        sVersion[128];
CTOVERLAPPED ctOverlapped;
ctOverlapped.hEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
ctCicode(hCTAPI, "Version(0)", 0, 0, sVersion, sizeof(sVersion), &ctOverlapped);
ctCancelIO(hCTAPI, &ctOverlapped);

Published June 2018