[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
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
Re: Getting a list of all windows...
Thanks dude :D It worked!
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. :)
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
Re: [RESOLVED] Getting a list of all windows...
anyone converted this to C#?