1、QQ 群 256416207作者:【机器猫】欢迎进群交流,转载请著名来源VB 制作模糊查找句柄的插件在类模块中插入以下代码:这是第一个插件函数,返回一个字符串Public Function Test1() As String Test1 = “Hello, world“End FunctionPublic Function GetWindowsHwnd(s As String) As LongTranslate.str = sCall EnumWindows(AddressOf Translate.EnumWndProc, 0&)GetWindowsHwnd = Translate.hWndE
2、nd Function在模块头插入以下代码:复制黏贴就可以了Public Declare Function EnumWindows Lib “user32“ (ByVal lpEnumFunc As Long, ByVal lParam As Long) As LongPublic Declare Function GetWindowText Lib “user32“ Alias “GetWindowTextA“ (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As LongPublic hWnd As Lon
3、gPublic str As StringPublic Function EnumWndProc(ByVal lhWnd As Long, ByVal lParam As Long) As Long EnumWindows 遍历窗口的回调函数Dim Title1 As String * 255 处理前窗口标题Dim Title2 As String 处理后窗口标题Call GetWindowText(lhWnd, Title1, 255&) 获取窗口标题If (InStr(Title1, str) 0&) ThenTitle2 = Left(Title1, InStr(Title1, Chr(0&) - 1&) 处理空白字符If Len(Title2) 0 Then 处理空字符Debug.Print lhWndTranslate.hWnd = lhWndEnd IfEnd IfEnumWndProc = True 继续下一个End Function然后生成插件 就可以放到 打开按键精灵写入以下代码:运行看看效果a=Plugin.Mcat.GetWindowsHwnd (“记事本“)If a = 0 Then MessageBox “窗口不存在 “ExitScriptElse MessageBox “窗口句柄为 :“&aEnd If