You can use this small routine I wrote a while back to see all windows that are running with their ClassNames, Captions and hWnds. Start a new project. Add a ListView and a module to your project. Copy this code to a module:
Module Code:
Code:
Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Public Function EnumWinProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
Dim strClassName As String
Dim strCaption As String
Dim lCaptionLength As Long
Dim lRet As Long
Dim lstItem As ListItem
strClassName = Space(255)
lRet = GetClassName(hwnd, strClassName, Len(strClassName))
Set lstItem = Form1.ListView1.ListItems.Add(, , hwnd)
If lRet Then
lstItem.SubItems(1) = Left(strClassName, lRet)
End If
lCaptionLength = GetWindowTextLength(hwnd)
strCaption = Space(lCaptionLength)
lRet = GetWindowText(hwnd, strCaption, lCaptionLength)
If lRet Then
lstItem.SubItems(2) = Left(strCaption, lRet)
End If
EnumWinProc = 1
End Function
Then copy this code to your Form:
Form Code:
Code:
Private Sub Form_Load()
Dim hdrHeader As ColumnHeader
With ListView1
.View = lvwReport
Set hdrHeader = .ColumnHeaders.Add(, , "hWnd")
Set hdrHeader = .ColumnHeaders.Add(, , "Class", 2000)
Set hdrHeader = .ColumnHeaders.Add(, , "Caption", 4000)
.FullRowSelect = True
End With
Call EnumWindows(AddressOf EnumWinProc, 0)
End Sub
Running the project will list all running windows (including hidden) with their hWnd, Class and Caption.