SetForegroundWindow在远程桌面连接 [英] SetForegroundWindow in Remote Desktop Connection
问题描述
我在C#中,它发送键到另一个程序的应用程序。要做到这一点我送其中工程键之前调用SetForegroundWindow方法。问题是,当我使用RDC和尽量减少RDC窗口或再断开连接键不发送连接到计算机。
I have an application in C# which sends keys to another program. To do that I call SetForegroundWindow method before sending keys which works. Problem is when I am connected to the computer using RDC and minimize the RDC window or disconnect it then keys are not sent.
这是因为当RDC模式,SetForegroundWindow方法在最小化或断开状态,无法正常工作。我一直在使用SetActiveWindow,SetFocus的和BringWindowToTop但没有运气尝试。有没有办法做到这一点?
It happens because when in RDC mode, SetForegroundWindow method doesn't work in minimized or disconnected state. I have tried using SetActiveWindow, SetFocus and BringWindowToTop but no luck. Is there any way to do that?
推荐答案
这是很常见的问题。当断开或最小化窗口RDP,GUI上下文丢失。但是你可以保持RDP非最小化(焦可以安全地丢失)。换言之只需打开全屏模式关闭,如果你想在本地继续工作切换到另一个窗口
This is very common problem. When you disconnect or minimize the RDP window, GUI context is lost. But you can keep RDP non-minimized (focus can be lost safely). In other words just turn full-screen mode off and switch to another window if you want to continue work locally.
在我们公司的测试团队使用主从方式:主主机启动远程连接,并让他们非最小化,直到每个GUI自动化任务就完成了。
In our company testing teams use master-slave approach: master host initiates remote connections and keeps them non-minimized until each GUI automation task is done.
这篇关于SetForegroundWindow在远程桌面连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!