C#中RDP/TS会话中的活动窗口 [英] Active Window in RDP/TS Session in C#

查看:109
本文介绍了C#中RDP/TS会话中的活动窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要这里的终端服务/RDP专家的帮助...

在C#中,有没有一种方法可以在TS/RDP环境中获取客户端的活动(前台)窗口? (我的应用程序与其他应用程序一起提供给客户端.)

在本地窗体应用程序中,我可以使用GetForegroundWindow,GetWindowThreadProcessId和Process.GetProcessById获取作为焦点窗口的Process对象.

我知道我可以使用Process.SessionId和WTSEnumerateProcesses来记录TS会话中正在运行的进程,但是有没有办法确定当前哪个进程的窗口处于活动状态?例如,我没有在WTS_PROCESS_INFO结构中看到此指示.

I need help from the Terminal Services/RDP experts here...

Is there a way in C# to get the active (foreground) window on the client side in a TS/RDP environment? (My application is served to the client with their other apps.)

In a local forms app, I can use GetForegroundWindow, GetWindowThreadProcessId, and Process.GetProcessById to get a Process object that is the window in focus.

I understand that I can use Process.SessionId and WTSEnumerateProcesses to file through the running processes in a TS session, but is there a way to determine which process'' window is currently active? I did not see an indication of this in the WTS_PROCESS_INFO struct, for example.

Any help you can provide would be awesome!

推荐答案

您的应用可以判断它是否在RDP会话中运行:

Your app can tell if it''s running in a RDP sesssion:

bool isRemote = System.Windows.Forms.SystemInformation.TerminalServerSession;



但是,从客户端获取任何信息似乎对我来说是一个安全漏洞.



However, getting any info from the client side seems like it would be a security breach to me.


这篇关于C#中RDP/TS会话中的活动窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆