Sending ctrl+C over serial port in C#?

前端 未结 1 1559
忘掉有多难
忘掉有多难 2021-01-07 12:57

How can I send my device ctrl+c through serial port in C#?

1条回答
  •  清酒与你
    2021-01-07 13:34

    Serial ports don't transmit keys. They transmit bytes, which are normally the ASCII representations of characters.

    "Keys.ControlKey & Keys.C" has to do with sensing what is going on on a PC keyboard. But serial ports do not transmit the whole state of the keyboard. For instance, the F keys and the arrows are entirely outside the ASCII system.

    An ASCII chart will tell you that, for instance, Ctrl-A is 1, Ctrl-B is 2, Ctrl-C is 3, 'A' is 65, and so on.

    0 讨论(0)
提交回复
热议问题