Results 1 to 3 of 3

Thread: searching window with API

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 1999
    Posts
    20

    Post

    Hello again all!

    Im having trouble finding the a window in WINDOWS98. I'm using VB5

    Here's my problam>

    There is a window called "AwtWindow" and it has no text. Let's call this window 1

    There is another window called "AwtWindow" and it has no text. Let's call this window 2


    Window 1 and Window 2 are diffrent programs.
    When I try and find Window2, it finds window 1 first.

    I closed window 1 and window 2 is found. But both windows(1 and 2) need to be open for it to work.

    How do I find window 2 by skipping around window 1?

    Get it??? LoL

    Thanks

  2. #2
    Lively Member
    Join Date
    May 1999
    Location
    Vancouver, BC, Canada
    Posts
    84

    Post

    I have a lot of API code that may help you.
    Send me your current email address and I will forward the code.

    Jon

  3. #3
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    It is very easy to find all windows with the same class name (or Caption) using FindWindowEx API. Here is an example:
    Code:
    Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    
    
    '------Put this on any event
        Dim lWindow As Long
        Dim iCount As Integer
    
        lWindow = FindWindowEx(0, 0, "AwtWindow", vbNullString)
    
        If lWindow Then
            Do While lWindow
                iCount = iCount + 1
                lWindow = FindWindowEx(0, lWindow, "AwtWindow", vbNullString)
            Loop
        End If
        MsgBox iCount & " windows found."
    Assuming that AwtWindow is a class name.

    ------------------

    Serge

    Software Developer
    Serge_Dymkov@vertexinc.com
    Access8484@aol.com
    ICQ#: 51055819


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