0

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 ?

dsolimano
  • 8,870
  • 3
  • 48
  • 63
MemoryLeak
  • 7,322
  • 23
  • 90
  • 133

1 Answers1

2

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
  • 182,639
  • 35
  • 285
  • 343
  • 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 Jul 30 '10 at 03:43