TwclComDatabase.ClaimPort(Cardinal) Method

Tries to get the lowest COM port number that is not already in use.

Namespace: wclSerialDevices
public
 function ClaimPort(out Port: Cardinal): Integer;

Parameters

Port
Type: Cardinal

If the method completed with success on output contains the free COM port number.

Return Value

Type: Integer

If the function succeed the return value is wclErrors.WCL_E_SUCCESS. Otherwise the method returns one of the WCL error codes.

Please note that this method does not create any serial device. This just makes you sure that no one other application and/or driver creates serial (COM) device with the same number.