views:

16

answers:

1

I have a hardware which connect with my computer via com interface, I want to implement such a feature: When the button on the hardware is clicked, My application can capture this event and then write something on my application.

So How can I listen to a specific COM interface and capture the event ? How can I get what command the hardware sent to me ?

+2  A: 

You're looking for the System.IO.SerialPort class. It will allow you to open a serial port (a COM port) and read and write data. As for the specifics about how to capture a button press, that would depend entirely on the device. If you know that it sends data over the COM port when a button is pressed, then you just need to know what to expect and you'll be able to capture it.

Adam Robinson
Thanks, is there any sample proejct for reference ? Or free software that I can Listen to the serial port, and know what the hardware send to me , then I can start to program.
MemoryLeak