I want to search for a com port that an instrument has been plugged into.
So I would like to go through all possible com ports, test which ones are
valid, and then test which valid port has data on it.
If I try to open a non existent com part, is there an error I can access?
When I check ERR after trying to open an invalid com port I always get 0.
Any suggestions?
TIA
how to search for valid com ports?
-
- Posts: 1
- Joined: Oct 25, 2012 17:19
Re: how to search for valid com ports?
You might be able to make use of this code, or parts of it.
http://www.freebasic.net/forum/viewtopi ... en#p153272
If you scan all available ports to see what is happening on each perhaps ????
http://www.freebasic.net/forum/viewtopi ... en#p153272
If you scan all available ports to see what is happening on each perhaps ????
Re: how to search for valid com ports?
Your operating system is...?I want to search for a com port that an instrument has been plugged into.
So I would like to go through all possible com ports, test which ones are
valid, and then test which valid port has data on it.
<snip>
Re: how to search for valid com ports?
if you're using Windows the easiest way is to look into the registry:
HKLM\HARDWARE\DEVICEMAP\SERIALCOMM lists all ports
Sample code
HKLM\HARDWARE\DEVICEMAP\SERIALCOMM lists all ports
Sample code