|
-
Dec 23rd, 2002, 01:07 PM
#1
Thread Starter
Lively Member
Viewing Processes
Hey i was wondering, how i can view all the processes running in memory and display them all in a listbox? thanks!
-
Dec 23rd, 2002, 01:33 PM
#2
Let me in ..
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.
-
Dec 23rd, 2002, 01:36 PM
#3
Thread Starter
Lively Member
-
Dec 23rd, 2002, 01:40 PM
#4
Fanatic Member
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.
-
Dec 23rd, 2002, 01:44 PM
#5
Thread Starter
Lively Member
OK ... i found this code on a search...
MODULE
-----------------------------------------------------------
VB Code:
Private Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
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
Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Private Const WM_GETTEXT = &HD
Private aCaptions() As String
Private lCount As Long
Public Function GetAllCaptions() As Variant
lCount = 0
Call EnumWindows(AddressOf EnumWindowsProc, 0&)
If lCount Then ReDim Preserve aCaptions(lCount - 1)
GetAllCaptions = IIf(lCount, aCaptions, Array())
End Function
Private Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
Dim sBuffer As String * 260
If IsWindowVisible(hwnd) Then
ReDim Preserve aCaptions(lCount)
aCaptions(lCount) = Left(sBuffer, SendMessage(hwnd, WM_GETTEXT, 260, ByVal sBuffer))
If Len(Trim(aCaptions(lCount))) Then lCount = lCount + 1
End If
EnumWindowsProc = hwnd
End Function
Form1 with i list box ( list1) and a command button
VB Code:
Private Sub Command1_Click()
Dim vCaps As Variant
Dim lIndex As Long
vCaps = GetAllCaptions()
List1.Clear
For lIndex = 0 To UBound(vCaps)
List1.AddItem vCaps(lIndex)
Next
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|