Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我问的主要是出于好奇。
使用 TestComplete 时,我注意到我可以将脚本指向任意正在运行的 .NET 应用程序,获取一个控件,对其进行反射,甚至调用它的方法。我不知道他们是怎么做到的。据我所知,这不是简单的 UIAutomation,因为我可以获取私有字段。此外,这不是远程处理,因为该应用程序没有额外的挂钩。
如何获取在另一个进程上运行的另一个 .NET 对象并调用它?
这是一种代码注入形式。
一旦你被注入做侵入性的事情,比如抓取私有变量等,使用 .Net 就容易多了,因为内省方面已经内置供你使用。
这篇代码项目文章向您展示了如何做到这一点