Unable to send underscore with Sendkeys in C#?

梦想与她 提交于 2019-12-22 06:03:11

问题


I've been bored, so I tried to make a program that writes a Look of Disapproval smiley(the ಠ_ಠ face) when pressing ctrl+shift+L. Now everything works, except for the underscore that is in the smiley, which won't get written at all.

This was what I used first:

SendKeys.Send("ಠ_ಠ");

I've tried various things, like adding {} brackets around the underscore, and of course I googled this too.

Is there any way I can get the underscore to get sent?

Thanks in advance.


回答1:


Mixing different encodings creates weird result. ಠ is Unicode, _ is ASCII. Different length characters confuse and iritate Visual Studio.

Try:

SendKeys.Send("\u0CA0_\u0CA0");

Or:

SendKeys.Send("\u0CA0\u005F\u0CA0");



回答2:


If you don't use an english keyboard layout that has the underscore as key you can't just type the ASCII character but have to write it as a combination of modifier and character keys.



来源:https://stackoverflow.com/questions/8217373/unable-to-send-underscore-with-sendkeys-in-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!