Hello everyone, this is my first post in this forum. I've tried searching but found nothing that solves my doubts.
I want to make a program that displays all usb devices connected to my laptop, showing their names, and the COM port they're connected to. Is that possible?
I managed to show the COM ports in use, but I'd like to get the name of the connected devices if possible. I used this code:
#using <System.dll>
using namespace System;
using namespace System::IO::Ports;
using namespace System::ComponentModel;
void main()
{
array<String^>^ serialPorts = nullptr;
try
{
// Get a list of serial port names.
serialPorts = SerialPort::GetPortNames();
}
catch (Win32Exception^ ex)
{
Console::WriteLine(ex->Message);
}
Console::WriteLine("The following serial ports were found:");
// Display each port name to the console.
for each(String^ port in serialPorts)
{
Console::WriteLine(port);
}
}