谁能给讲一讲API中各个枚举窗口函数的具体含义和用法,参考书上的术语看不懂啊。谢谢了,因为分不多,只能给30了。

解决方案 »

  1.   

    Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long'该函数是EnumWindows的回调函数,EnumWindows函数将遍历的窗口句柄传递到hwnd参数中
    Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
      Dim astr As String * 256
      Dim l As Long
      
      l = GetWindowText(hwnd, astr, Len(astr))  '得到窗口的标题
      If InStr(astr, " ") > 1 Then
        Form1.List1.AddItem astr
      End If
      EnumWindowsProc = True
    End FunctionPrivate Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long l = EnumWindows(AddressOf EnumWindowsProc, 0)