Results 1 to 2 of 2

Thread: Enumerate Windows (app only)

  1. #1

    Thread Starter
    Fanatic Member clarkgriswald's Avatar
    Join Date
    Feb 2000
    Location
    USA
    Posts
    799

    Exclamation 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?

  2. #2
    Hyperactive Member Fedhax's Avatar
    Join Date
    Aug 2006
    Posts
    293

    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:
    1. Private Sub Form_Load()
    2.     'KPD-Team 2000
    3.     'URL: [url]http://www.allapi.net/[/url]
    4.     'E-Mail: [email][email protected][/email]
    5.     Dim ThreadID As Long, ProcessID As Long  ' receive id to thread and process of Form1
    6.  
    7.     ' Determine the thread which owns this window
    8.     ThreadID = GetWindowThreadProcessId(Me.hWnd, ProcessID)
    9.  
    10.     ' Use the callback function to list all of the enumerated thrad windows
    11.     EnumThreadWindows ThreadID, AddressOf EnumThreadWndProc, 0
    12. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width