获取窗口区域 - GetWindowRect
函数简介
获取指定窗口的屏幕坐标区域,包括标题栏、边框和客户区。
接口名称
GetWindowRect
DLL调用
int GetWindowRect(long ola, long hwnd, int* x1, int* y1, int* x2, int* y2);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| hwnd | 长整数型 | 目标窗口的句柄。 |
| x1 | 整数型指针 | 返回窗口左上角的X坐标。 |
| y1 | 整数型指针 | 返回窗口左上角的Y坐标。 |
| x2 | 整数型指针 | 返回窗口右下角的X坐标。 |
| y2 | 整数型指针 | 返回窗口右下角的Y坐标。 |
示例
int x1, y1, x2, y2;
int ret = GetWindowRect(instance, hwnd, &x1, &y1, &x2, &y2);
if (ret == 1) {
printf("窗口区域: (%d,%d)-(%d,%d), 大小: %dx%d\n", x1, y1, x2, y2, x2-x1, y2-y1);
}
返回值
1 成功,0 失败。
