|
-
Dec 12th, 2005, 10:58 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Getting a list of all windows...
Does any one know of a way to get a list of all the programs that are running? I've found some code that allows me to get the Window handler (i think it's called, the big number for each window) & then change that into the window's caption... But is there any way to get a list of all the windows any way?
Added [RESOLVED] to thread title and green "resolved" checkmark - Hack
Last edited by Hack; Dec 12th, 2005 at 11:47 AM.
-
Dec 12th, 2005, 11:09 AM
#2
Re: Getting a list of all windows...
This uses a ListBox to display the running processes.
VB Code:
'Place The Code In A Module. This Is Necessary Because A Callback using The AddressOf Operator
'Is Used In This Code
'in a module
Public Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, _
ByVal lParam As Long) As Long
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _
(ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Const MAX_LEN = 260
Public Function EnumWinProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
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
Form1.List1.AddItem Left(strBuffer & " " & hwnd, lRet)
End If
End If
EnumWinProc = 1
End Function
'on a form
Private Sub Command1_Click()
Call EnumWindows(AddressOf EnumWinProc, 0)
End Sub
-
Dec 12th, 2005, 11:18 AM
#3
Thread Starter
Fanatic Member
Re: Getting a list of all windows...
Thanks dude It worked!
-
Dec 12th, 2005, 11:23 AM
#4
Re: Getting a list of all windows...
You are welcome.
If this is resolved, please pull down the Thread Tools menu and click the Mark Thread Resolved button. That will let everyone know that you have your answer.
Thanks.
-
Dec 13th, 2005, 12:55 AM
#5
Thread Starter
Fanatic Member
Re: [RESOLVED] Getting a list of all windows...
oh yeah, sorry, i was just comming back to do that and you had already done it :d
-
Jan 27th, 2006, 01:22 AM
#6
Lively Member
Re: [RESOLVED] Getting a list of all windows...
anyone converted this to C#?
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
|