SendKeys.SendWait method in C#, emulating CTRL+C

*爱你&永不变心* 提交于 2019-12-10 19:14:07

问题


I'm trying to hold down CTRL while C is pressed but I can't get it work. I've read SendKeys Class but still, it doesn't work.

Thats what I've tried:

SendKeys.SendWait("^C");
SendKeys.SendWait("{^C}");
SendKeys.SendWait("^{C}");
SendKeys.SendWait("^(C)");
SendKeys.SendWait("(^{C})");

回答1:


You need to put in parenthesis. Example:

SendKeys.SendWait("^(c)");

Notice that c should be lowercase. It is case sensitive




回答2:


use + instead of ^ for shift and put in parenthesis. (^ for control and + for shift; in your question you said shift). And remember c must be in lowercase.

SendKeys.SendWait("+(c)");



回答3:


If you're trying to do SHIFT while pressing C, you're using the wrong codes. ^ is CTRL. Shift is +.



来源:https://stackoverflow.com/questions/9789214/sendkeys-sendwait-method-in-c-emulating-ctrlc

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