取色 - GetColor
函数简介
获取绑定窗口指定坐标点的颜色值,返回格式为"RRGGBB"的十六进制字符串。
接口名称
GetColor
DLL调用
long GetColor(long ola, int x, int y);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| x | 整数型 | 要获取颜色的X坐标 |
| y | 整数型 | 要获取颜色的Y坐标 |
示例
long colorPtr = GetColor(ola, 100, 100);
if (colorPtr != 0) {
string color = GetStringFromPtr(colorPtr);
printf("坐标(100, 100)的颜色为:%s\n", color.c_str());
FreeStringPtr(ola, colorPtr);
}
返回值
长整数型:返回颜色字符串指针,格式为"RRGGBB"(小写)。失败返回0。
注意事项
- 返回的字符串指针需调用 FreeStringPtr 释放内存。
- 坐标超出屏幕范围将返回空字符串。
