间谍++ 对于 PowerBuilder 应用程序

发布于 2024-07-25 01:50:55 字数 829 浏览 4 评论 0原文

我正在尝试编写一个工具来检查基于 PowerBuilder 的应用程序的状态。 我想到的是类似 Spy++(或者更好的是 .NET 应用程序中存在的“Snoop”)之类的东西,它可以让我检查某些基于 PowerBuilder 的 GUI 的对象树(以及对象的属性)。

我已经对普通(基于 MFC)应用程序以及 .NET 应用程序做了同样的事情,但不幸的是我自己从未在 PowerBuilder 中开发过应用程序,所以此时我通常会考虑两个问题:

  1. 是否有一些可用的 API(最好是 Java 或 C/C++)可以让人们遍历 PowerBuilder 应用程序的可视对象树? 我读了一些关于 PowerBuilder 本机接口系统的内容,但这似乎是为了用 C/C++ 编写 PowerBuilder 扩展,然后可以从 PowerBuilder 脚本语言调用它,对吗?

  2. 如果有一些可用的 API - 也许 PowerBuilder 应用程序甚至公开某种支持 IPC 的 API,让我可以检查 PowerBuilder 对象层次结构的状态,而无需在 PowerBuilder 应用程序的进程内? 也许有一个可用的自动化接口,或者基于 COM 的东西 - 或者其他东西?

现在,我的印象是可能需要将 DLL 注入到 PowerBuilder 应用程序的进程中,然后访问正在运行的 PowerBuilder VM,以便我可以查询它的对象树。 然后,某种 IPC 机制将允许我将此信息传输到 PowerBuilder 应用程序的进程之外。

有没有人对此有一些经验,或者可以阐明是否有人已经尝试这样做?

最好的问候,

  • 弗里希

I'm trying to write a tool which lets me inspect the state of a PowerBuilder-based application. What I'm thinking of is something like Spy++ (or, even nicer, 'Snoop' as it exists for .NET applications) which lets me inspect the object tree (and properties of objects) of some PowerBuilder-based GUI.

I did the same for ordinary (MFC-based) applications as well as .NET applications already, but unfortunately I never developed an application in PowerBuilder myself, so I'm generally thinking about two problems at this point:

  1. Is there some API (preferably in Java or C/C++) available which lets one traverse the
    tree of visual objects of a PowerBuilder application? I read up a bit on the PowerBuilder Native Interface system, but it seems that this is meant to write PowerBuilder extensions in C/C++ which can then be called from the PowerBuilder script language, right?

  2. If there is some API available - maybe PowerBuilder applications even expose some sort of IPC-enabled API which lets me inspect the state of a PowerBuilder object hierarchy without being within the process of the PowerBuilder application? Maybe there's an automation interface available, or something COM-based - or maybe something else?

Right now, my impression is that probably need to inject a DLL into the process of the PowerBuilder application and then gain access to the running PowerBuilder VM so that I can query it for the object tree. Some sort of IPC mechanism will then let me transport this information out of the PowerBuilder application's process.

Does anybody have some experience with this or can shed some light on whether anybody tried to do this already?

Best regards,

  • Frerich

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

帥小哥 2024-08-01 01:50:55

首先,简单的答案:我认为你想做的事情已经完成了。 Rex from Enable 做了我认为你想要的事情,但是IIRC 从与开发人员的交谈中得知,这取决于应用程序中内置的代码挂钩。

这导致我认为您无法完全在应用程序外部执行我认为您尝试执行的操作。 您可以使用 WinAPI 获取窗口句柄并用其执行一些基本操作,但不会达到您想要的那么多。 并使用 WinAPI 获取有关 DataWindows 的信息? 忘了它。

相信我听说过像您所问的那样的API,但我从未听说过任何其他自动化测试软件工具制造商使用过它。 如果这是真的(并且该信息的质量类似于“在走廊里听到的”),我怀疑泄露出去可能会存在一些应用程序安全问题。 (我知道永远不想感染我的应用程序,或者四处寻找并找出我的秘密。咧嘴笑

即使挂钩到PowerBuilder VM内存空间,我'我不知道在没有一些 PowerScript 框架挂钩的情况下能够获取内存中的对象列表(例如,使用对象句柄填充每个打开和构造函数上的列表)。 一旦获得了窗口句柄,您就可以轻松地遍历其控制数组(及其子类控制数组)以获取窗口上的对象列表,但是诸如 NVO 实例变量的句柄之类的东西会出现问题。

我很欣赏这个想法。 我希望我有更好的消息(除了雷克斯可能会解决你的问题,而无需自己动手)。 现在我更加期待eran可能会发布什么! 咧嘴笑

祝你好运,

特里。

First, the easy answer: I think what you're trying to do has been done, sort of. Rex from Enable does what I think you're after, but IIRC from talking with the developers, it depends on code hooks built into the application.

Which leads to the suggestion that I don't think you'll be able to do what I think you're trying to do completely externally from the application. You can grab window handles with WinAPIs and do some basic things with that, but not as much as you want. And getting information about DataWindows with WinAPIs? Forget it.

I believe I've heard of an API like the one you're asking about, but I've never heard of anyone other that automated testing software tool manufacturers getting their hands on it. If this is true (and the quality of this information is along the lines of "heard it in the hallway"), I suspect there might be some application security issues in letting this get out. (I know you'd never want to infect my application, or poke around and find out my secrets. grin)

Even with hooks into the PowerBuilder VM memory space, I'm not aware of being able to get a list of objects in memory without some PowerScript framework hooks (e.g. populating a list on every open and constructor with object handles). Once you've got a window handle, you can easily traverse its control arrays (and its subclasses control arrays) to get a list of objects on the window, but things like handles to NVO instance variables would be problematic.

I admire the idea. I wish I had better news (other than maybe Rex might solve your problem without the headaches of doing it yourself). Now I'm looking forward even more to what eran may release! grin

Good luck,

Terry.

梦魇绽荼蘼 2024-08-01 01:50:55

我刚刚创建了这样一个工具,但我做了一些作弊。 实际上我自己也想在 PB 新闻组上问同样的问题。 我的解决方案由两部分组成:

类似 Spy 的工具 - 一个类似于 Spy++ 的独立应用程序,即允许您使用 Windows API 函数(尽管是用 PB 编写的)将目标拖动到控件上。

目标应用程序的内部基础结构 - 位于所有应用程序窗口的祖先。 一旦给定了某个(Windows)句柄,它就会遍历 Control[] 数组并查找其句柄与给定句柄匹配的控件。 如有必要,它还会递归到选项卡等控制容器中。

当用户选择一个控件时,间谍工具首先使用 Windows API 查找其包含的窗口。 找到后,该工具会向该窗口发送一条自定义消息,然后由应用程序的基础设施处理。 然后,该控件位于 PB 应用程序中,其详细信息最终被发送回间谍工具,由间谍工具将其呈现给用户。

我怀疑基础设施部分可以用一些外部东西替换,因为我已经看到似乎能够做到这一点的工具(Visual Expert,QTP)。 不过,我还没有时间进一步研究,而且这个解决方案相对容易开发。

我不得不说,你的问题出现的时机令人惊讶。 请参阅我最近提出的这个问题。 如果您对我创建的工具感兴趣,请给我留言。

I've just created such a tool, but I cheated a bit. Was actually about to ask the same question myself on the PB newsgroups. My solution is made of two parts:

Spy-like tool - a stand-alone app that like Spy++, i.e. lets you drag a target onto a control, using Windows API functions (though written in PB).

Internal infrastructure for target applications - located at the ancestor of all of the application's windows. Once given a certain (windows) handle, it goes through the Control[] array and looks for the control whose handle matches the given one. If necessary, it also recurses into control-containers such as tabs.

When the user selects a control, the spy tool first looks for its containing window using Windows API. When found, the tool sends a custom message to that window, which is then handled by the app's infrastructure. The control is then located in the PB app, and its details are finally sent back to the spy tool, which presents them to the user.

I suspect the infrastructure part can be replaced with some external thing, as I've seen tools that seem to be able to do that (Visual Expert, QTP). However, I haven't had the time to further investigate, and this solution was relatively easy to develop.

I've got to say, your question comes on a surprising timing. See this recent question of mine. If you're interested in the tool I've created, drop me a comment.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文