从外部应用程序读取屏幕上的文本。 API 挂钩?

发布于 2024-11-03 17:20:21 字数 186 浏览 1 评论 0原文

我有 Java 背景,因此对 C# 和 C++ 的了解有限。基本上我试图从屏幕上显示的另一个应用程序“读取”文本...

此处输入图像描述">

将此文本读入 Java 程序的最佳方法是什么?我已经开始了解 API 挂钩,这是唯一的方法吗?我该如何在 Java 中做到这一点?

谢谢 菲尔

I have a Java background so have limited knowledge when it comes to C# and C++. Basically I am trying to "read" text from another application which is displayed on screen...

enter image description here

To be specific, I want to read the dealer chat message from Pokerstars... on the fly...

What is the best way to read this text into a Java program on the fly? Ive head about API hooking, is this the only way and how would I do this in Java?

Thanks
Phil

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

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

发布评论

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

评论(2

執念 2024-11-10 17:20:21

一种方法是,只要文本没有消除锯齿(如图像中所示),该方法就有效:

从您的应用程序中,截取其他应用程序窗口的屏幕截图。在屏幕截图中搜索所有非白色像素。列出所有非白色像素。对于列表中的每对非白色像素,如果该对彼此接触,则将它们放入同一“组”中。这样做直到所有像素都组合在一起。

然后,对于每个组,将其形状与预定义形状表进行比较。如果表格中没有该形状,请要求用户键入字母,然后将形状及其对应的字母保存到表格中。

现在窗口中的所有字母都有 ASCII 代码了。

这不是从窗口中抓取文本的最干净的方法,但它很难被击败。对于其他应用程序使文本难以被计算机阅读的任何举动,它也会变得更难以被人类阅读,这降低了应用程序的有用性。

One way to do it, which works as long as text is not anti-aliased, like in your image:

From your application, take a screenshot of the other application's window. Search the screenshot for all non-white pixels. Make a list of all the non-white pixels. For each pair of non-white pixels in the list, if the pair touches each other, put them in the same "group." Do this until all the pixels are grouped together.

Then for each group, compare its shape to a table of predefined shapes. If the shape isn't in the table, ask the user to type the letter, then save the shape and which letter it is to the table.

Now you have ASCII codes for all the letters in the window.

This is not the cleanest way to scrape text from a window, but it is hard to defeat. For any move made by the other application to make the text harder to read by a computer, it will become harder to read by a human, which lowers the usefulness of the application.

终陌 2024-11-10 17:20:21

如果您想要连接的应用程序是 c#,那么反射器可能是一个不错的起点。

http://reflector.red-gate.com/download.aspx?TreatAsUpdate= 1

您想要研究的另一件事是读取网络流量并抓取该级别的数据。在这种情况下,请查看wireshark。

http://www.wireshark.org/

您可以创建一个代理,将数据定向到该代理通过网络级别的应用程序,您将其传递,但​​读出有趣的部分。

祝你好运。

If the application you want to hook into is c# then maybe reflector is a good place to start.

http://reflector.red-gate.com/download.aspx?TreatAsUpdate=1

Another thing you wany want to look into is reading the network traffic and grabbing the data at that level. In which case take a look at wireshark.

http://www.wireshark.org/

You may be able tgo create a proxy, where data is directed through your application at the network level and you pass it on but read out the interesting parts.

Good Luck.

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