如何获取指定像素点的色彩值
请教如何用vbs获取指定坐标的像素点色彩值,谢谢 能说的详细点么 换个问题获取static文本框的背景色。 考:http://www.advancedqtp.com/knowledge-base/qtips/win32-id66/get-pixel-color/
Dim hDC, hWndDim iX, iY
'Declare win32 and gdi32 functions
Extern.Declare MicLong, "GetPixel", "gdi32″, "",MicLong, MicLong, MicLong
Extern.Declare MicLong, "GetDC", "user32″,"", MicLong
Extern.Declare micLong,"ReleaseDC","user32″,"",micLong,micLong
'Attach to the desktop graphical context
hWnd = cLng(0)
hDC = Extern.GetDC(hWnd)
iX = 10 'Change this to your relevant X coordinate
iY = 10 'Change this to your relevant Y coordinate
'Get the pixel color code
Print Extern.GetPixel (hDC, iX,iY)
'Release the graphical context
Extern.ReleaseDC hWnd, hDC
hWnd = cLng(0)
hDC = Extern.GetDC(hWnd)
这两行是获取屏幕设备吧。
我想要的可能会是被QTP遮盖住的软件的某个控件的颜色 hWnd = cLng(0)
hDC = Extern.GetDC(hWnd)
这两行是获取屏幕设备吧。
我想要的可能会是被QTP遮盖住 ...
mgs2-007 发表于 2011-4-26 10:32 http://bbs.51testing.com/images/common/back.gif
获取指定位置的颜色值
xorg = Browser("网易电子邮箱").Page("网易电子邮箱").Frame("index").Image("260x300").GetROProperty("abs_x")
yorg = Browser("网易电子邮箱").Page("网易电子邮箱").Frame("index").Image("260x300").GetROProperty("abs_y")
width = Browser("网易电子邮箱").Page("网易电子邮箱").Frame("index").Image("260x300").GetROProperty("width")
height = Browser("网易电子邮箱").Page("网易电子邮箱").Frame("index").Image("260x300").GetROProperty("height")
xnow = xorg + width/2
ynow = yorg + height/2
Extern.Declare micLong, "GetPixel","gdi32","",micLong,micLong,micLong
Extern.Declare micLong, "GetDC", "user32","",micLong
Extern.Declare micLong,"ReleaseDC","user32","",micLong, micLong
hWnd = cLng(0)
hDC = Extern.GetDC(hWnd)
Print Extern.GetPixel (hDC, xnow,ynow)
Extern.ReleaseDC hWnd, hDC
页:
[1]