3

我想获取有关第三方应用程序控件的信息,例如其属性及其值的列表:类似于 RTTI 信息,但适用于第三方 Delphi 应用程序。

我看到这是可能的。例如,TestComplete 有 ObjectSpy 窗口,它可以提供有关控件的许多有用信息,包括 RTTI 信息。如何才能做到这一点 ?

在此处输入图像描述

编辑:解释我为什么要调查这个问题......我是 TestComplete/ TestExecute的注册用户,我喜欢......大部分。我可以克服一些小问题,但对我来说一个主要问题是他们的许可证验证系统,它要求我始终拥有一台物理计算机(而不是虚拟机),只是为了运行许可证服务器,以便 TestExecute 可以在夜晚。由于我有基本的测试需求(比较屏幕截图并检查基本 Delphi 组件的属性),我想知道制作我自己的私有非常简单的“类似 TestExecute”的应用程序会有多难。

4

2 回答 2

3

更进一步,我建议您在 SO 上找到这些相关资源


我强烈建议您将这个名为Get Process Info with NtQueryInformationProcess的c++ 项目移植到 Delphi 使用ReadProcessMemory访问用于启动另一个进程的命令行的实践经验。


最后编辑:

于 2012-04-18T15:08:42.890 回答
2

When we want to take another application which is compiled with debug information and get stuff out of it at runtime, what we are dealing with is the problem of "how to write my own custom debugger/profiler/automated-test kernel".

TestComplete and other AutomatedQA programs contain a Debugger and Profiler Kernel which can start up, run and remotely control apps, and parse their Debug information in several formats, including the TurboDebugger TD32 information attached to these executables. Their profiling kernel also can see each object as it is created, and can iterate the RTTI-like debug information to determine that an object that was created is of a particular class type, and then see what properties exist in that object.

Now, TestComplete adds on top of the AQTime-level of stuff, the ability to introspect Window handles, and intuit from Window Handles, the Delphi class Names that are behind it. However, it's much easier for you (or me) to write a program which can tell you that the mouse is over a window handle that belongs to a TPanel, than to know which version of Delphi created that particular executable, what version of TPanel that is, then, and what properties it would contain, and to read those values back from a running program, which requires that you implement your own "debugger engine". I am not aware of any open source applications that you could even use to get a start writing your own debugger, and you certainly can't use the ones that are inside AQTime/TestComplete, or the one inside Delphi itself, in your own apps.

I could not write you a sample program to do this, but even if I could, it would require a lot of third-party library support. To see the window classes for a window handle which your mouse is over, look for how to implement something like the MS Spy++ utility.

An easy case is if your mouse is mousing over a window inside your own application. For that, see this about.com link, which simply uses RTTI.

于 2012-04-13T18:08:10.380 回答