查找窗口 - FindWindow
函数简介
查找符合类名或者标题名的顶层可见窗口。
接口名称
FindWindow
DLL调用
long FindWindow(long ola, string class, string title);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| class | 字符串 | 窗口类名,支持模糊匹配。为空字符串则匹配所有类名。 |
| title | 字符串 | 窗口标题,支持模糊匹配。为空字符串则匹配所有标题。 |
示例
// 查找标题包含"记事本"的窗口
long hwnd = FindWindow(instance, "", "记事本");
if (hwnd != 0) {
printf("找到窗口,句柄: %ld\n", hwnd);
}
返回值
长整数型:找到的窗口句柄。未找到返回 0。
