enumwin.bas

来自「列出Windows程序的进程」· BAS 代码 · 共 18 行

BAS
18
字号
Attribute VB_Name = "Module1"
Option Explicit

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

Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Boolean
    Dim S As String
    
    S = String(80, 0)
    Call GetWindowText(hwnd, S, 80)
    S = Left(S, InStr(S, Chr(0)) - 1)
    
    If Len(S) > 0 Then Form1.List1.AddItem S
    
    EnumWindowsProc = True
End Function

⌨️ 快捷键说明

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