Enumerate Windows (app only)
I want to enumerate all the windows in MY application only. What I am trying to do is search all windows in my application, determine if the window is a Message Box (class name) and if it is, use SendMessage to close it. So how do I enumerate ONLY the windows in my application as opposed to ALL windows on the system?
Re: Enumerate Windows (app only)
Quote:
Originally Posted by clarkgriswald
I want to enumerate all the windows in MY application only. What I am trying to do is search all windows in my application, determine if the window is a Message Box (class name) and if it is, use SendMessage to close it. So how do I enumerate ONLY the windows in my application as opposed to ALL windows on the system?
Maybe try the EnumThreadWindows API call. It is designed to only enumerate through all of the windows tied to a particular thread (i.e. your application ):
VB Code:
Private Sub Form_Load()
'KPD-Team 2000
'URL: [url]http://www.allapi.net/[/url]
Dim ThreadID As Long, ProcessID As Long ' receive id to thread and process of Form1
' Determine the thread which owns this window
ThreadID = GetWindowThreadProcessId(Me.hWnd, ProcessID)
' Use the callback function to list all of the enumerated thrad windows
EnumThreadWindows ThreadID, AddressOf EnumThreadWndProc, 0
End Sub