从qtp中的对象中提取颜色
我有一个对象(它是一个窗口),它有许多颜色区域。有没有办法 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过
abs_x
和abs_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 theabs_y
(for the position on the desktop) orx
andy
(for the position in the parentwindow). Through the external lib located in gdi32.dll, you can use theGetPixel(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 thehwnd
property of the Window or Desktop object (depending if you are usingabs_x/y
orx/y
).