Serial Communications - baud rate

G

Guest

I am using the Serial Port class for serial communications, It is very easy
to use but there is one thing I want to do and can't figure out how.
SerialPort.GetPortNames() gives me a list of all the Serial Ports on the
system. I let the end user select one from the list. I also want to give the
user the ability to specify the baud rate for the selected port. However, I
could not find an interface that will list all the baud rates for a given
port. I looked in the registry and the values did not seem to be there.

Anyone know how I can get the supported baud rates for any serial port?

Thanks in Advance,

Bob Costello
 
M

Matt Lacey

I am using the Serial Port class for serial communications, It is very easy
to use but there is one thing I want to do and can't figure out how.
SerialPort.GetPortNames() gives me a list of all the Serial Ports on the
system. I let the end user select one from the list. I also want to give the
user the ability to specify the baud rate for the selected port. However, I
could not find an interface that will list all the baud rates for a given
port. I looked in the registry and the values did not seem to be there.

Anyone know how I can get the supported baud rates for any serial port?

Thanks in Advance,

Bob Costello

There isn't a managed calls for this in the framework (yet - we live
in hope)

This information is available through the API function:
GetCommProperties - http://msdn2.microsoft.com/En-US/library/aa363259.aspx

For an example on pinvoking it see:
http://pinvoke.net/default.aspx/kernel32/GetCommProperties.html
or
http://www.webtropy.com/articles/art9-1.asp?f=GetCommProperties

Alternatively, have a look at http://www.codeproject.com/dotnet/DotNetComPorts.asp
where a lot of the work is done for you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top