Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

sendkeys

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})");
like image 224
Patryk Avatar asked Jan 17 '23 04:01

Patryk


2 Answers

You need to put in parenthesis. Example:

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

Notice that c should be lowercase. It is case sensitive

like image 173
Jonas W Avatar answered Jan 29 '23 12:01

Jonas W


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)");
like image 25
PraveenVenu Avatar answered Jan 29 '23 13:01

PraveenVenu