区域找图代码类:摘自 神罗模块QQ447186060[转载请注明]
Function 找色_区域找色(左上角x As Integer, 左上角y As Integer, 右下角x As Integer, 右下角y As Integer, 十进制原色 As Long) As String '成功返回坐标(111,111)或失败反回空字符串
Dim a As Long, b As Long, X1%, Y1%
找色_区域找色 = ""
For Y1 = 左上角y To 右下角y
For X1 = 左上角x To 右下角x
a = GetDC(0)
b = GetPixel(a, X1, Y1) '坐标
If b = 十进制原色 Then '14215660 Then '十进制原色(把16进制转换成10进制)
找色_区域找色 = X1 & "," & Y1
Exit Function
End If
Call ReleaseDC(0, a) '释放
Next
Next
End Function