Author Topic: How to detect if COM Port exists?  (Read 1285 times)


  • Newbie
  • *
  • Posts: 4
    • View Profile
How to detect if COM Port exists?
« on: November 17, 2013, 04:42:52 pm »

Is there a way to check if a specific COM Port still exists?

I am doing a "LoadConfig" from the Registry, to restore the last-used COM Port, but get an error if this port no longer exists (e.g. if USB-Serial adaptor has been removed).

Regards, Nigel

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1016
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: How to detect if COM Port exists?
« Reply #1 on: November 17, 2013, 04:54:48 pm »

You can use following methods and properties for getting serial port list and try to find necessary port before open it:

Code: [Select]
    procedure GetDeviceList(L:TStrings);
    property DeviceIndex:integer;
    property Device[Index:integer]:TnrDevice;
    property DeviceCount:integer;

Roman Novgorodov
DeepSoftware llc
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.