GetSerialPort Method

Retrieves string value of serial port name.

Syntax

Delphi
function GetSerialPort(index: Word): String;  
BCBuilder
String GetSerialPort(Word index); 
  

Parameters

index

[in] Index of serial port (0 ... number_of_ports - 1).

Return

String value representing serial port name.

Code Example

var 
    i: integer
    PortName: string
    PortsCount: Word
begin 
    try 
        PortsCount := FTSPCControl1.EnumSerialPorts(); 
        if PortsCount > 0 then 
        begin 
            for i := 0 to PortsCount - 1 do 
            begin 
                PortName := FTSPCControl1.GetSerialPort(i); 
 
                // Todo: add your code 
 
            end
        end
    except 
        on e:FTSPCException do 
        begin 
            application.MessageBox( 
                PChar('Error: ' + inttostr(e.ErrorCode) +  
                ' - ' + e.ErrorSource), 'Error!', MB_OK +  
                MB_ICONERROR); 
        end
    end
end