FtVspcSetQueryOpenByNum Function

Sets value of QueryOpen flag.

BOOL FtVspcSetQueryOpenByNum(
	UINT unPortNo,
	BOOL bQueryOpen 
	);

Parameters

unPortNo

[in] The number of virtual serial port.

bQueryOpen

[in] QueryOpen flag value.

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.
ftvspcErrorMarkedForDeletion 202 This port is marked for deletion.

Remarks

QueryOpen flag allows the developer to react on virtual serial port opening. So, your application can allow or prohibit access to the serial port.
If QueryOpen is FALSE, the port can be opened by any application.
If QueryOpen is TRUE, it is still not possible to open port if your application is not attached to the port (refer to FtVspcAttach). ERROR_ACCESS_DENIED error code is returned in such case. If attached, ftvspcPortEventQueryOpen event fires and the event handler decides, if it is allowed to open virtual serial port to the application or not.

See Also

FtVspcGetQueryOpenByNum, FtVspcSetQueryOpen