Pergunta

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 ?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top