如何将击键发送到 vb.net 中的串行端口?
我正在尝试向 COM2 发送 ctrl-x 按键,并且我必须编写代码来打开端口并进行读写,但是当我尝试发送 Chr(Keys.ControlKey + Keys.X)
时,它确实这样做了不工作。有什么想法吗?
I am trying to send a ctrl-x keystroke to COM2 and I ahve to code to open the port and read and write but when I tried to send Chr(Keys.ControlKey + Keys.X)
it did not work. any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果这是交互式的,则传递 KeyChar 的事件将已经传递一个 Char 类型,该类型将是 CONTROL-X。
如果您尝试生成该值,那么 Control-X 实际上就是字母表中 X 的字母。它是第 24 个字母,在 ASCII 中就是 24 或 0x18。
所以也许您想要一个常量,即 Chr(24)。
If this is interactive, the event that passes KeyChar will already pass a Char type that will be the CONTROL-X.
If your trying to generate the value, then Control-X is really just what letter is X in the alphabet. Its the 24th letter, and in ASCII that would just be 24 or 0x18.
So maybe you want a constant for it that would just be Chr(24).