Results 1 to 3 of 3

Thread: enumerating task manager apps

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2001
    Posts
    16

    enumerating task manager apps

    um ... one other thing

    can you enumerate all the applications showing in the applications tab of task manager for NT/2K

    i know how to enumerate all the processes running, or all the services... but i want the full titles of each app showing in the applications tab... mainly so i can check the internet explorer titles of the pages that users are viewing

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    In a module
    VB Code:
    1. Private Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
    2. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    3. Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
    4.  
    5. Private Const WM_GETTEXT = &HD
    6.  
    7. Private aCaptions() As String
    8. Private lCount As Long
    9.  
    10. Public Function GetAllCaptions() As Variant
    11.     lCount = 0
    12.     Call EnumWindows(AddressOf EnumWindowsProc, 0&)
    13.     If lCount Then ReDim Preserve aCaptions(lCount - 1)
    14.     GetAllCaptions = IIf(lCount, aCaptions, Array())
    15. End Function
    16.  
    17. Private Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
    18.     Dim sBuffer As String * 260
    19.     If IsWindowVisible(hwnd) Then
    20.         ReDim Preserve aCaptions(lCount)
    21.         aCaptions(lCount) = Left(sBuffer, SendMessage(hwnd, WM_GETTEXT, 260, ByVal sBuffer))
    22.         If Len(Trim(aCaptions(lCount))) Then lCount = lCount + 1
    23.     End If
    24.     EnumWindowsProc = hwnd
    25. End Function
    In a form (with listbox - List1)
    VB Code:
    1. Private Sub Command1_Click()
    2.  
    3.     Dim vCaps As Variant
    4.     Dim lIndex As Long
    5.    
    6.     vCaps = GetAllCaptions()
    7.     List1.Clear
    8.     For lIndex = 0 To UBound(vCaps)
    9.         List1.AddItem vCaps(lIndex)
    10.     Next
    11.  
    12. End Sub

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2001
    Posts
    16
    j33z m8

    ur a bl00dy L3g3nD

    seriously ... thanks man

    j00 da m4s73r

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width