函数说明: FindWindow ParentWindowHandle,WindowAfterHandle,WindowClassName,WindowTitle 根据条件查找Windows窗口。 ParentWindowHandle:要查找的窗口的父窗口,整型; WindowAfterHandle:从父窗口的该窗口开始查找,整型; WindowClassName:要查找的窗口类名称,字符串; WindowTitle:要查找的窗口标题,字符串或整型。 返回整数型:查找到的窗口句柄。 如 a = sys.FindWindow(0,0,"Notepad",0) a = sys.FindWindow(0,0,"Notepad","无标题 - 记事本")
举例: 在a.bsp的画面中加载一个Button对象,在脚本编辑器中编辑该Button的Click事件如下: Sub BSButton1_OnClick() a = sys.FindWindow(0,0,"Notepad",0) End Sub 运行a.bsp画面,点击Button,获取找到的第一个记事本窗口的句柄,句柄返回到“a”中。 |