屏幕坐标转窗口坐标 - ScreenToClient
函数简介
将屏幕坐标转换为窗口客户区坐标。
接口名称
ScreenToClient
DLL调用
int ScreenToClient(long ola, long hwnd, int* x, int* y);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| hwnd | 长整数型 | 目标窗口的句柄。 |
| x | 整数型指针 | 传入屏幕X坐标,返回对应的客户区X坐标。 |
| y | 整数型指针 | 传入屏幕Y坐标,返回对应的客户区Y坐标。 |
示例
int x = 500, y = 300;
int ret = ScreenToClient(instance, hwnd, &x, &y);
if (ret == 1) {
printf("客户区坐标: (%d, %d)\n", x, y);
}
返回值
1 成功,0 失败。
