程序說明:
EnumWindows : 列舉系統中的所有窗口
GetWindowText : 取的窗口的標題
EnumWindowsProc :用戶自定義函數,給EnumWindows調用,以達到列舉的目的
AddressOf : 取的函數的地址,此函數一定在放在 Module 中
所有的控件:
| List1 Command1 Command1 |
程序代碼:
Module1 Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long Public Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Dim S As String S = String(80, Chr(0)) If Len(S) > 0 Then EnumWindowsProc2 = True End Function Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Boolean Form1 Private Sub Command1_Click() List1.Clear Private Sub Command2_Click()
End Sub Private Sub Form_Load() End Sub |