Results 1 to 5 of 5

Thread: Viewing Processes

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2002
    Location
    Under the Boardwalk
    Posts
    79

    Viewing Processes

    Hey i was wondering, how i can view all the processes running in memory and display them all in a listbox? thanks!
    -=]{ i ( ( er =-

  2. #2
    Let me in .. techyspecy's Avatar
    Join Date
    Aug 2002
    Location
    Back to VBF.
    Posts
    2,456

    Re: Viewing Processes

    Originally posted by killerSD
    Hey i was wondering, how i can view all the processes running in memory and display them all in a listbox? thanks!
    search for this question in this forum. I am sure this question has been answered million times before.(Ok - Bad example ) But it has been answerd lot of times before.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2002
    Location
    Under the Boardwalk
    Posts
    79
    ok Thanks
    -=]{ i ( ( er =-

  4. #4
    Fanatic Member scr0p's Avatar
    Join Date
    Oct 2002
    Location
    VA
    Posts
    720
    Move this to the API forum.
    I am also trying to make the same thing kinda, a mini API spy to try to learn how to use WindowFromPoint, fIndWindow, GetWindowTextLength.. etc all of that. I will post the code if I ever finish it.
    asdf

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Dec 2002
    Location
    Under the Boardwalk
    Posts
    79
    OK ... i found this code on a search...

    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

    Form1 with i list box ( list1) and a command button

    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
    ------------------------

    this code is awesome but it doesnt "view all processes" so i guess i have to move this topic. thanks for the help
    -=]{ i ( ( er =-

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