Technical Reference > CtAPI Functions > Function Reference > ctGetOverlappedResult


Returns the results of an overlapped operation. The results reported by the ctGetOverlappedResult() function are those of the specified handle's last CTOVERLAPPED operation to which the specified CTOVERLAPPED structure was provided, and for which the operation's results were pending. A pending operation is indicated when the function that started the operation returns FALSE, and the GetLastError function returns ERROR_IO_PENDING. When an I/O operation is pending, the function that started the operation resets the hEvent member of the CTOVERLAPPED structure to the non-signaled state. Then when the pending operation has been completed, the system sets the event object to the signaled state.

If the bWait parameter is TRUE, ctGetOverlappedResult() determines whether the pending operation has been completed by waiting for the event object to be in the signaled state.

Specify a manual-reset event object in the CTOVERLAPPED structure. If an auto-reset event object is used, the event handle needs to not be specified in any other wait operation in the interval between starting the CTOVERLAPPED operation and the call to ctGetOverlappedResult(). For example, the event object is sometimes specified in one of the wait functions to wait for the operation's completion. When the wait function returns, the system sets an auto-reset event's state to non-signaled, and a subsequent call to ctGetOverlappedResult() with the bWait parameter set to TRUE causes the function to be blocked indefinitely.


ctGetOverlappedResult(hCTAPI, lpctOverlapped, pBytes, bWait)


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


Input/output: Input
Description: Address of the CTOVERLAPPED structure which was used when an overlapped operation was started.


Type: DWORD*
Input/output: Input
Description: Address of actual bytes transferred. For the CTAPI this value is undefined.


Type: BOOL
Input/output: Input
Description: Specifies whether the function waits for the pending overlapped operation to be completed. If TRUE, the function does not return until the operation has been completed. If FALSE and the operation is still pending, the function returns FALSE and the GetLastError function returns ERROR_IO_INCOMPLETE.

Return Value

If the function succeeds, the return value is TRUE. If the function does not succeed, the return value is FALSE. Use GetLastError() to get extended error information.

Related Functions

ctOpen, ctHasOverlappedIoCompleted


DWORD								Bytes;
char sVersion[128];
CTOVERLAPPED ctOverlapped;
ctOverlapped.hEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
ctCicode(hCTAPI, "Version(0)", 0, 0, sVersion, sizeof(sVersion), &ctOverlapped);
// do something else.
// wait for the ctCicode to complete
ctGetOverlappedResult(hCTAPI, &ctOverlapped, &Bytes, TRUE);