Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1529

EnumPorts - Find the system's COM and/or LPT ports

$
0
0
The EnumPorts class will find the COM ports, LPT ports, or both. If a new device arrives or leaves the list of devices gets refreshed.

The information you can retrieve is:

  • PortDescription
  • PortName
  • PortNumber
  • PortType


These can be retrieved by index from 1 to Count or by key (PortName, e.g. "COM1:").

Each refresh raises the Refresh event so you can update a menu, etc.


Name:  sshot1.png
Views: 27
Size:  2.7 KB

Menu populated by demo's Form1


Name:  sshot2.png
Views: 24
Size:  3.2 KB

Plugged in a USB serial IoT device. Got a Refresh event.
Menu updated to show the current list


Name:  sshot3.png
Views: 26
Size:  2.0 KB

Menu item clicked on, Form1 printed some of its info


No special requirements, but Windows 2000 or newer is required. Only tested on Windows 10 1709.
Attached Images
   
Attached Files

Viewing all articles
Browse latest Browse all 1529

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>