Access Com Port

S

Stanley

Hi all,
Can anyone tell me whether visual studio .net supports serial port
accessibility. I am now doing a project, an unspecified machine is pluged
into computer's serial port. GUI is necessary. After i searched the MSDN, I
cannot found any solution about how VS .net handles com port reading. I
wouldn't like to spend a lot of time on GUI design, so C language is not
preferred. So, somebody said that i should use VB or C# to develop a program
which can read data from serial port. Thank you for your attention.

Some information:
- the machine returns 8 numbers to computer periodically (< 1 second)
- Number includes hex. and binary value, e.g. hhbbbbbb
h = hex, b = binary value

cheers,
Stanley
 
W

William Ryan

Yes, it does. There's a lot to it in some regards and you need to get into
the WinAPI.

To determine the Status of a port:

[DllImport("Kernel32.DLL")]
public static extern bool GetCommState(IntPtr hFile, ref DCB dcb);

This API should get you there...there's a lot of code for me to post here.
...but you can find the documentation on the Structs on Google.

If you are going to do much with this, let me REcommend .Net Framework
Solutions, In Search of the Lost Win32 API by John Paul Mueller, he's got a
ton of stuff in there. I don't have the book in front of me, but I can
probably zing you much of the code in the morning.

Cheers,

Bill
 

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