FtVspcRemovePortByNum Function

Removes a virtual serial port.

BOOL FtVspcRemovePortByNum(
	UINT unPortNo 
	);

Parameters

unPortNo

[in] The number of virtual serial port (1-255).

Return Value

If the function succeeds, the return value is TRUE. Otherwise, use FtVspcGetLastError to get the error code (FtVspc_ErrorCode).

Errors

ftvspcErrorFailed 1 The operation has not been completed.
ftvspcErrorNoSuchPort 101 There is no such port.
ftvspcErrorPortAttached 200 This port is already attached.
ftvspcErrorPortInUse 201 This port is opened by serial application.
ftvspcErrorMarkedForDeletion 202 This port is marked for deletion.

Remarks

If COM port has been removed successfully, the function returns TRUE.

If COM port is occupied by a serial application, the function returns TRUE and sets last error code to ftvspcErrorPortInUse. COM port will be removed on COM port close. This COM port appears with MarkedForDeletion flag enabled when enumerate virtual serial ports.

If any application is attached to the COM port, the function returns FALSE and sets last error code to ftvspcErrorPortAttached.

See Also

FtVspcGetVirtual