Solved

Identifying COM port devices in Delphi

Posted on 2008-10-30
4
797 Views
Last Modified: 2013-11-23
How can I programmatically identify the devices that have attached themselves to the various COM ports (i.e. rs232, modem, bluetooth)?
Certainly msinfo32.exe can identify them, so there must be some system info somewhere to pull this from.

Thanks
SF
0
Comment
Question by:sheepfarmer
  • 2
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
MerijnB earned 500 total points
ID: 22845620
use WMI:

select * from win32_serialport

results on my machine in:

let me know if you need help using WMI


Availability	2	2	2	2	
Binary	True	True	True	<empty>	
Capabilities	<empty>	<empty>	<empty>	<empty>	
CapabilityDescriptions	<empty>	<empty>	<empty>	<empty>	
Caption	Conexant D110 MDC V.92 Modem	Communications Port (COM1)	Standard Serial over Bluetooth link (COM5)	Standard Serial over Bluetooth link (COM4)	
ConfigManagerErrorCode	0	0	0	0	
ConfigManagerUserConfig	False	False	False	False	
CreationClassName	Win32_SerialPort	Win32_SerialPort	Win32_SerialPort	Win32_SerialPort	
Description	Conexant D110 MDC V.92 Modem	Communications Port	Standard Serial over Bluetooth link	Standard Serial over Bluetooth link	
DeviceID	COM3	COM1	COM5	COM4	
ErrorCleared	<empty>	<empty>	<empty>	<empty>	
ErrorDescription	<empty>	<empty>	<empty>	<empty>	
InstallDate	<empty>	<empty>	<empty>	<empty>	
LastErrorCode	<empty>	<empty>	<empty>	<empty>	
MaxBaudRate	128000	115200	9600	<empty>	
MaximumInputBufferSize	0	0	0	<empty>	
MaximumOutputBufferSize	0	0	0	<empty>	
MaxNumberControlled	<empty>	<empty>	<empty>	<empty>	
Name	Conexant D110 MDC V.92 Modem	Communications Port (COM1)	Standard Serial over Bluetooth link (COM5)	Standard Serial over Bluetooth link (COM4)	
OSAutoDiscovered	True	True	True	True	
PNPDeviceID	PCI\VEN_8086&DEV_266D&SUBSYS_542314F1&REV_03\3&61AAA01&0&F3	ACPI\PNP0501\4&15F2F7D1&0	BTHENUM\{00001101-0000-1000-8000-00805F9B34FB}\7&3180A61D&0&000000000000_00000000	BTHENUM\{00001101-0000-1000-8000-00805F9B34FB}\7&3180A61D&0&00121C20088A_C00000000	
PowerManagementCapabilities	1	1	1	1	
PowerManagementSupported	False	False	False	False	
ProtocolSupported	<empty>	<empty>	<empty>	<empty>	
ProviderType	Modem Device	RS232 Serial Port	RS232 Serial Port	<empty>	
SettableBaudRate	True	True	True	<empty>	
SettableDataBits	True	True	True	<empty>	
SettableFlowControl	True	True	True	<empty>	
SettableParity	True	True	True	<empty>	
SettableParityCheck	True	True	False	<empty>	
SettableRLSD	True	True	True	<empty>	
SettableStopBits	True	True	True	<empty>	
Status	OK	OK	OK	OK	
StatusInfo	3	3	3	<empty>	
Supports16BitMode	False	False	False	<empty>	
SupportsDTRDSR	True	True	True	<empty>	
SupportsElapsedTimeouts	True	True	True	<empty>	
SupportsIntTimeouts	True	True	True	<empty>	
SupportsParityCheck	True	True	False	<empty>	
SupportsRLSD	True	True	True	<empty>	
SupportsRTSCTS	True	True	True	<empty>	
SupportsSpecialCharacters	False	False	False	<empty>	
SupportsXOnXOff	True	True	False	<empty>	
SupportsXOnXOffSet	True	True	False	<empty>	
SystemCreationClassName	Win32_ComputerSystem	Win32_ComputerSystem	Win32_ComputerSystem	Win32_ComputerSystem	
SystemName	HEATHROW	HEATHROW	HEATHROW	HEATHROW	
TimeOfLastReset	<empty>	<empty>	<empty>	<empty>	

Open in new window

0
 

Author Comment

by:sheepfarmer
ID: 22845800
Yeah, that's what I need - I need to extract a list of devices that are attached to a COM port (ideally identified COM1 = Robotics Modem, COM2 = Bluetooth etc)

If you can help with a complete example for WMI, I would be very grateful.

Thanks
SF
0
 
LVL 19

Assisted Solution

by:MerijnB
MerijnB earned 500 total points
ID: 22848427
First, you might need to import some type libraries, for help, take a look here: http://www.ciuly.com/delphi/wmi/settingUpWmi/index.html (thanks Ciuly!)

I've been working on a simple to use WMI wrapper. It's not done by far, but far enough for you to achieve this.
You can download it with an example program here: https://filedb.experts-exchange.com/incoming/ee-stuff/7349-wmi_serialport.zip

If I press the button on my machine, it gives me this list:

COM1=Communications Port
COM3=Conexant D110 MDC V.92 Modem
COM4=Standard Serial over Bluetooth link
COM5=Standard Serial over Bluetooth link

Oh, and if you wonder why it is so slow, sorry, WMI just is.
0
 

Author Comment

by:sheepfarmer
ID: 22874707
Thanks for the code/exe - great start.

Most grateful
SF
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Unable to start eclipse ? 17 163
Delphi inherited method 6 80
What is the Best Editor for PHP Development ? 5 92
Typecasting TBytes to Integer in Delphi XE8 2 38
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question