是否有一种方法可以在客户端系统上运行程序以查看在主机远程桌面窗口内发生的事件? [英] Is there a way for a Program ran on a Client system to See events that happen inside the Host Remote Desktop Window?

查看:186
本文介绍了是否有一种方法可以在客户端系统上运行程序以查看在主机远程桌面窗口内发生的事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

情况(程序的所有部分都是使用C#构建的):



程序必须在CLIENT PC上运行。用户将使用远程桌面连接中内置的窗口手动登录主机。在任何给定时间只能打开一个远程连接。



我很好奇,如果有一种方法让客户端PC上运行的程序看到窗口/出现在主机 - 远程桌面窗口中的消息框。客户端PC程序不需要实际与Host-RDC交互,只需要查看事件发生的时间。当客户端程序看到指定的事件时,它会向用户发送通信,以便可以启动新任务。



我在这里读过多个线程如何让系统登录,例如

远程使用C#.NET的桌面

Palantir - 远程桌面管理器 < a href =http://www.codeproject.com/Articles/19836/Palantir-Remote-Desktop-Managertarget =_ blanktitle =New Window>



但是,我一直非常不走运,想方设法在Host-RDC窗口中进行交互或查看事件。



< b>本质上,程序必须在客户端系统上运行,并且会查找要显示的某些窗口r在Host-RDC窗口内。如果Client-PC程序在Host-RDC窗口中注意到一组特定窗口,则Client-PC程序将启动警报/标记。



感谢您提供的任何帮助!非常感谢,即使它是指向我错过的文章的直接链接!

The situation (all parts of program are built using C#):

The program MUST run on a CLIENT PC. A user will manually login to the Host using windows built in Remote Desktop Connection. Only one Remote Connection will be open at any given time.

I am curious if there is a way for the program running on the Client PC to "see" windows/msg-boxes that appear in the Host-Remote Desktop Window. The Client PC program does not need to actually interact with the Host-RDC, it only needs to see when the events happen. When the Client-Program sees the specified events, it will send communication to the user so that new tasks can be started.

I have read multiple threads on here talking about how to get a system to log in, such as
Remote Desktop using C#.NET
Palantir - Remote Desktop Manager

but, I have been very unlucky in finding a way to interact or see events that happen within the Host-RDC window.

Essentially, the program must be running on the Client system and will look for certain windows to appear within in the Host-RDC window. If the Client-PC program notices a set of specific windows within the Host-RDC window, the Client-PC program will initiate alerts/flags.

Thank you for any help that can be provided! It is greatly appreciated, even if it is a directly link pointing me to an article I missed!

推荐答案

为什么不创建服务器/客户端程序集?使用TCP或RDP以外的其他协议创建服务器客户端关系并不困难。 '客户'可以监控主机上的任何活动(以及控制它)并报告回'服务器'。
Why not create a server / client program set? It's not too difficult to create a server client relationship using TCP or some other protocol other than RDP. The 'client' can monitor pretty much any activity on the host machine (as well as control it) and report back to the 'server'.


AsmoconX写道:
AsmoconX wrote:

这是一个测试环境,并不打算在远程系统上添加或修改信息(用于验证和测试要求)。测试过程要求我们使用远程桌面连接登录系统并在该远程桌面环境中执行一组测试(同样,远程系统没有其他连接方法,如USB,PS2,VGA等。只是一个控制台网络线插头)。远程PC已经安装,配置了操作系统,并且预装了专门的测试程序,必须运行这些程序以进行验证。



登录后对于远程系统,我们使用远程系统上已有的软件进行多天的测试。



最终目标只是找到一种方法让个人知道测试何时完成或出错。该程序将能够检测远程桌面窗口中的完成/错误窗口并打开灯,向操作员发送电子邮件以及其他各种事项。



可以有20种不同的系统进行这样的测试,每个Test-PC都必须进行监控,以确定何时需要采取新措施。因此,最终目标是减少因人无法开启每台显示器而损失的时间,检查远程显示器,根据需要采取措施或关闭显示器并继续检查其他显示器。如果事件可以被中继,就像我通过一个监视远程窗口的程序说的那样,它们就不会被占用检查系统,甚至可能不需要注意。



老实说,我不知道怎么解释它。 :(

This is a test environment and information is not meant to be added or modified on the remote systems (for validation and testing requirements). The test-process requires us to login to the system using a Remote Desktop Connection and perform a set of tests within that Remote Desktop Environment (Again, the remote system does not have other connection methods such as USB, PS2, VGA, etc..Just a console network line plug). The remote PCs already have the operating system installed, configured, and have specialized test-programs pre-loaded onto them that must be ran for validation purposes.

After we login to the remote system, we perform multiple days worth of tests using the software already on the remote system.

The end-goal was simply to find a way to let individuals know when a test has completed or had an error. The program would be able to detect that completion/error window within the remote desktop window and turn on a light, send an email to the operator, and various other things.

There can be 20 different systems testing like this and each Test-PC must be monitored to see when it is time for a new action. So, the final objective is to reduce the time lost because a person is unable to go turn on each monitor, check the remote display, act if needed or turn display back off and continue check the other displays. If the event could be relayed, like I was saying through a program that was monitoring the remote window, they would not be occupied checking systems that may not even require attention yet.

I honestly do not know how else to explain it. :(

现在,问题得到了正确解释,谢谢。



嗯,整个测试场景对我来说简单可疑,但我可以想象设置在哪里这样的场景存在写入。我希望找到一些可用于此类测试的产品,但这需要花费很多时间。请参阅:http://en.wikipedia.org/wiki/Test_automation#Graphical_User_Interface_.28GUI.29_testing [ ^ ]。



查看此工具列表: http://en.wikipedia.org/wiki/List_of_GUI_testing_tools [ ^ ]。



也许你可能需要测试其中一些并进行评估。



熟悉许多不同的测试方法是很好的。另请参阅:

http://en.wikipedia.org/wiki/Software_testing [< a href =http://en.wikipedia.org/wiki/Software_testingtarget =_ blanktitle =New Window> ^ ]。



现在,由于我不能给出关于使用任何特定工具的最终判断,我将解释您需要的工具如何工作。它还将向您解释如何自己开发此类工具。这并不容易,但我做过这样的事情,他们是可行的。我将从最简单的场景开始。



这是一个想法:作为用户,您可以使用RDP连接(在您的情况下,您不应该也不需要创建任何自定义)并手动执行所有测试。然后你需要多次重复测试。人类操作员不能多次重复的唯一问题,特别是如果你需要一直这样做(我说,这仍然是最简单的情况)。现在,假设您有一些间谍应用程序,它记录所有系统全局鼠标和键盘事件,并可以在整个测试系统上播放它们,从头到尾完成所有测试周期。其中一些事件将转到RDP客户端窗口,RDP将透明地将它们传递给测试下的计算机,并且该远程计算机将重现人类操作员的所有操作。



如何实施?不是很容易,但很可行。首先,录音。您将需要使用Windows Hook。请从这里开始: http://msdn.microsoft。 com / zh-CN / library / windows / desktop / ms632589%28v = vs.85%29.aspx [ ^ ]。



有两种方法:

  • 您只能使用本地挂钩。这比全局钩子简单得多。你需要设置 dwThreadId ;这应该是RDP客户端的线程。最大的简化是:你可以使用P / Invoke在.NET中完成所有工作:

    http ://en.wikipedia.org/wiki/P/Invoke [ ^ ],

    http:/ /msdn.microsoft.com/library/en-us/vcmxspec/html/vcmg_PlatformInvocationServices.asp [ ^ ]。



    本地钩子的一个显着好处是:所有事件与您的RDP客户端无关的问题。



    一个小问题是:它可能需要一个可以托管钩子的自定义RDP客户端在其代码中,这实际上有利于开发和测试。这不是一个最大的问题:您已经熟悉RDP客户端,不是吗? : - )




  • 使用全局挂钩可以做到这一点。如果您指定无线程,则挂钩将是系统全局的。它们难以开发,事件更难以测试。你无法在.NET中完成所有这些工作。您将不得不开发一些本机(非托管)DLL设置钩子并进行钩子处理。根据Microsoft文档,如果挂钩是全局的,则需要此类DLL。您需要在.NET代码中加载此DLL,并使用某种线程同步机制与钩子函数进行通信。
  • Now, the problem is properly explained, thank you.

    Well, the whole testing scenario simple questionable to me, but I can imagine setting where such scenarios have a write to exist. I hoped to find some available products for this kind of testing, but it's going to take a lot of time. Please see: http://en.wikipedia.org/wiki/Test_automation#Graphical_User_Interface_.28GUI.29_testing[^].

    Review this list of tools: http://en.wikipedia.org/wiki/List_of_GUI_testing_tools[^].

    Perhaps you may need to test some of them and evaluate.

    It's good to get more familiar with many different approaches to testing. See also:
    http://en.wikipedia.org/wiki/Software_testing[^].

    Now, as I cannot give you my final verdict on using any of the particular available tools, I'll explain how the tool you need has to work. It will also explain to you how can you develop such tool on your own. It is not going to be easy, but I've done such things, they are doable. I'll start with the simplest scenario.

    Here is the idea: as a user, you can connect using RDP (in your case, you should not and need not create anything custom) and do all the testing manually. Then you need to repeat the test many times. The only problem that the human operator cannot repeat it many times, especially if you need to do it consistently (I say, this is still the simplest scenario). Now, imagine that you have some spy application which records all the system-global mouse and keyboard events and can play them back on your whole testing system, to complete all the test cycle from the beginning to the end. Some of those events will go to RDP client window, and RDP will transparently pass them to the computer under the test, and that remote computer will reproduce all the actions of the human operator.

    How to implement it? Not very easy, but quite doable. First of all, recording. You will need to use Windows Hooks. Please start here: http://msdn.microsoft.com/en-us/library/windows/desktop/ms632589%28v=vs.85%29.aspx[^].

    There are two approaches:

    • You can use just the local hooks. This is much simpler than the global hook. You need to set the dwThreadId; and this should be the thread of the RDP client. The biggest simplification is: you can do it all in .NET, using P/Invoke:
      http://en.wikipedia.org/wiki/P/Invoke[^],
      http://msdn.microsoft.com/library/en-us/vcmxspec/html/vcmg_PlatformInvocationServices.asp[^].

      One considerable benefit of local hooks is: all the events unrelated to your RDP client go out of equation.

      A little problem is: it may require a custom RDP client which can host the hook in its code, which is actually good for development and testing. This is not a biggest problem: you are already familiar with RDP clients, don't you? :-)


    • Nothing like that can be done with global hooks. If you specify no thread, the hook will be system-global. They are hard to develop, event harder to test. And you cannot do it all in .NET. You will have to develop some native (unmanaged) DLL setting the hook and doing hook handling. According to Microsoft documentation, such DLL is required if the hook is global. You will need to load this DLL in your .NET code and communicate with the hook functions using some thread synchronization mechanism.

    • 这篇关于是否有一种方法可以在客户端系统上运行程序以查看在主机远程桌面窗口内发生的事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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