从qtp中的对象中提取颜色

发布于 2024-12-13 16:23:20 字数 143 浏览 5 评论 0原文

我有一个对象(它是一个窗口),它有许多颜色区域。有没有办法 qtp 可以只从该窗口中的特定区域提取颜色。不能使用 GetROProperty 和 currentStyle.color,因为它将给出整个窗口的颜色。我只需要该窗口中特定区域的颜色。

非常感谢。

I've an object(which is a window) and it has many regions of colors in it. is there a way qtp can extract only the color from a specific region in that window. GetROProperty and currentStyle.color cannot be used since it will give the color of the whole window. I only need the color of a specific region in that window.

Thank you very much.

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

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

发布评论

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

评论(1

念三年u 2024-12-20 16:23:20

您可以通过 abs_xabs_y(针对桌面上的位置)或 x 和 < 来获取对象的 X 和 Y 坐标。 code>y (表示父窗口中的位置)。通过位于gdi32.dll中的外部库,您可以使用GetPixel(hDC, X, Y)函数。

hDC 是设备上下文,您可以通过调用 user32.dll 中的外部函数 GetWindowDC(hWnd) 来获取它。您需要一个窗口句柄,可以从窗口或桌面对象的 hwnd 属性中提取该窗口句柄(具体取决于您使用的是 abs_x/y 还是 x/y )。

You can get the X and Y coordinates of an object through the abs_x and the abs_y (for the position on the desktop) or x and y (for the position in the parentwindow). Through the external lib located in gdi32.dll, you can use the GetPixel(hDC, X, Y) function.

hDC is the Device Context and you can get it by calling the external function GetWindowDC(hWnd) from the user32.dll. You need a Window Handle, that can be extracted from the hwnd property of the Window or Desktop object (depending if you are using abs_x/y or x/y).

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