主题
查找窗口 - FindWindow
函数简介
查找符合类名或者标题名的顶层可见窗口。
接口名称
FindWindowDLL调用
long FindWindow(long ola, string class, string title);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| class | 字符串 | 窗口类名,支持模糊匹配。为空字符串则匹配所有类名。 |
| title | 字符串 | 窗口标题,支持模糊匹配。为空字符串则匹配所有标题。 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
long hwnd = ola.FindWindow("Notepad", "无标题 - 记事本");csharp
using OLAPlug;
var ola = new OLAPlugServer();
long hwnd = ola.FindWindow("Notepad", "无标题 - 记事本");python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
hwnd = ola.FindWindow("Notepad", "无标题 - 记事本")java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
long hwnd = ola.FindWindow("Notepad", "无标题 - 记事本");cpp
var ola = com("OlaPlug.OlaSoft")
var hwnd = ola.FindWindow("Notepad", "无标题 - 记事本")vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
hwnd = ola.FindWindow("Notepad", "无标题 - 记事本")text
.局部变量 ola, OLAPlug
ola.创建 ()
hwnd = ola.FindWindow(“Notepad“, “无标题 - 记事本“)aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var hwnd = ola.FindWindow("Notepad", "无标题 - 记事本");text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
长整数 hwnd = ola.FindWindow("Notepad", "无标题 - 记事本")cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
long hwnd = ola.FindWindow("Notepad", "无标题 - 记事本");原生 DLL 调用
cpp
long instance = CreateCOLAPlugInterFace();
long hwnd = FindWindow(instance, "Notepad", "无标题 - 记事本");csharp
long instance = CreateCOLAPlugInterFace();
long hwnd = FindWindow(instance, "Notepad", "无标题 - 记事本");python
from ctypes import CDLL, c_int, c_int64, create_string_buffer
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
hwnd = FindWindow(instance, "Notepad", "无标题 - 记事本")返回值
| 返回值 | 说明 |
|---|---|
| (返回值) | 长整数型:找到的窗口句柄。未找到返回 0。 |
