MODULE CODE
Then I just use:Code:Public Function EnumWinProc2(ByVal hwnd As Long, ByVal lParam As Long) As Long On Error Resume Next Dim lRet As Long Dim strBuffer As String If IsWindowVisible(hwnd) Then strBuffer = Space(MAX_LEN) lRet = GetWindowText(hwnd, strBuffer, Len(strBuffer)) If lRet Then If left(strBuffer, lRet) = "Program Manager" Or left(strBuffer, lRet) = "TracerOS2000" Then GoTo iNext Else With fForm Set itmX = .lstTemp.ListItems.Add(, , left(strBuffer, lRet)) lComponent = FindWindow(vbNullString, left(strBuffer, lRet)) itmX.SubItems(1) = lComponent Load .picForm(.picForm.Count) GetWindowRect lComponent, rRect .picForm(.picForm.Count - 1).Width = (rRect.Right - rRect.left) .picForm(.picForm.Count - 1).Height = (rRect.Bottom - rRect.tOp) .picForm(.picForm.Count - 1).tOp = rRect.tOp .picForm(.picForm.Count - 1).left = rRect.left .picForm(.picForm.Count - 1).Tag = lComponent .picForm(.picForm.Count - 1).Visible = True End With iNext: End If End If End If EnumWinProc2 = 1 End Function
Code:fForm.lstTemp.ListItems.Clear Call EnumWindows(AddressOf EnumWinProc2, 0)




Reply With Quote