Plugin Hwnd = Window.MousePoint()
MessageBox Hwnd
以上粘到按键里面。鼠标指像你要获取的窗口,够简单了吧
给你个例子,用的是遍历符合窗口标题的句柄保存到数值串里的方法:
dim x,y,ck,HwndEx
dim MyArray
HwndEx = Plugin.Window.Search("《天龙八部2》")
Msgbox cstr(HwndEx)
MyArray = Split(HwndEx, "|")
If UBound(MyArray)>=0 Then
i=0
For UBound(MyArray)
//下面这句将字符串转换成数值
Call Plugin.Window.Active(MyArray(i))
Delay 500
Call Plugin.Window.Active(MyArray(i))
Delay 500
Msgbox "第 "&i+1 &" 个窗口句柄为:"&Clng(MyArray(i))
i=i+1
Next
ck=MyArray(0)
End If
//得到当前窗口句柄
Delay 500
Beep
------------------------------
还有两个方法:
1,得到当前最前面的窗口句柄
Hwnd = Plugin.Window.Foreground()
2,得到鼠标指向的窗口句柄
Hwnd = Plugin.Window.MousePoint()
希望能帮到你
没分的