⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 module1.bas

📁 枚举所有句柄 可以获取当前所有窗体的 柄局
💻 BAS
字号:
Attribute VB_Name = "Module1"
'**************************************************
'模块代码:Module1.bas
'**************************************************
Option Explicit

Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long

Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
Dim lpBuffer As String * 1024
Dim dwWindowCaption As String
Dim lpLength As Long

lpLength = GetWindowText(hwnd, lpBuffer, 1024)
dwWindowCaption = Left(lpBuffer, lpLength)
Form1.List1.AddItem dwWindowCaption & "[" & hwnd & "]"

If InStr(dwWindowCaption, "旺旺") > 0 Then
'停止查找函数返回0
EnumWindowsProc = 0
MsgBox hwnd
Else
'继续查找函数返回1
EnumWindowsProc = 1
End If
End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -