FtVspcAttachByNum Function

Attaches to virtual COM port.

FTVSPCHANDLE FtVspcAttachByNum(
	UINT unPortNo,
	LPFNVSPCPORTEVENTS lpfnOnEvent,
	LONG_PTR Context 
	);

Parameters

unPortNo

[in] COM port number (e.g. 5 means COM5).

lpfnOnEvent

[in] A pointer to the function to call on virtual serial port event (cannot be NULL). Refer to FtVspc_PortEvent.

Context

[in] User context (any value).

Return Value

Handle of virtual serial port (0, if cannot attach to the port). This value is not system handle, it is internal Virtual Serial Port Control handle.

Errors

ftvspcErrorFailed 1 The operation has not been completed.
ftvspcErrorInvalidParameter 2 Invalid parameter.
ftvspcErrorNoSuchPort 101 There is no such port.
ftvspcErrorPortAttached 200 This port is already attached.
ftvspcErrorMarkedForDeletion 202 This port is marked for deletion.

See Also

FtVspc_PortEvent, FtVspcAttach, FtVspcDetach