0

How do I get the port details of the Bluetooth device that I have paired within my windows form c# application? Manually I can get all port names but I need the com port name that allocated to particular Bluetooth Device.

Swarup
  • 95
  • 1
  • 3
  • 15

1 Answers1

1

Check this post

the Win32_PnPEntity is Plug and play devices MSDN

you can go on the drivers also to find your device

            // The WMI query 
            const string QueryString = "SELECT * FROM Win32_PnPSignedDriver ";


            SelectQuery WMIquery = new SelectQuery(QueryString);
            ManagementObjectSearcher WMIqueryResults = new ManagementObjectSearcher(WMIquery);

            // Make sure results were found
            if (WMIqueryResults == null)
                return;

            // Scan query results to find port
            ManagementObjectCollection MOC = WMIqueryResults.Get();

            foreach (ManagementObject mo in MOC)
            { 
                if (mo["FriendlyName"] != null && mo["FriendlyName"].ToString().Contains("YOUR_DEVICE_NAME"))
                {}
              //Check the mo Properties to find the COM port
            }
Community
  • 1
  • 1
RcMan
  • 893
  • 8
  • 16