[英]Perform Ctrl-C on specific window without focusing it
I have an application to which I want to send the Ctrl - C keys combination.我有一个应用程序,我想将Ctrl - C组合键发送到该应用程序。 I am trying with
SendMesssage
, but I know that the application checks for Ctrl - C combination using GetKeyState
and GetAsyncKeyState
so SendMessage
is pretty useless... How can I send the Ctrl - C combination to this window without calling SetForegroundWindow(hWnd)
?我正在尝试使用
SendMesssage
,但我知道应用程序使用GetKeyState
和GetAsyncKeyState
检查Ctrl - C组合,因此SendMessage
非常无用......如何在不调用SetForegroundWindow(hWnd)
情况下将Ctrl - C组合发送到此窗口? I need a solution which works without focusing/bringing to front the window.我需要一个无需聚焦/带到窗前即可工作的解决方案。
I am temporarily using this code (but requires focus):我暂时使用此代码(但需要重点):
SetForegroundWindow(hWnd);
SendKeys.SendWait("^(c)");
I am using C#, but C++ code is ok.我使用的是 C#,但 C++ 代码没问题。
A long time ago, back when I was doing Sys Admin automation.. I used AutoIT.很久以前,当我在做 Sys Admin 自动化时……我使用了 AutoIT。 It's been a long time, but if you don't mind picking up their .dll...
已经很长时间了,但如果你不介意拿起他们的 .dll ......
This is the method I'd use.. it mentions you can send directly to a window/control without focus.. in some cases you can't..这是我使用的方法..它提到你可以直接发送到没有焦点的窗口/控件..在某些情况下你不能..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.