Find the second HWND of two identical elements

This is a discussion on Find the second HWND of two identical elements within the Windows Programming forums, part of the Platform Specific Boards category; Hey, I've uploaded a screenshot of what Spy++ is telling me. I'm trying to find the HWND of the element ...

  1. #1
    Registered User
    Join Date
    Mar 2006
    Location
    USA::Colorado
    Posts
    155

    Find the second HWND of two identical elements

    Hey,

    I've uploaded a screenshot of what Spy++ is telling me. I'm trying to find the HWND of the element highlighted, however the first dialog is taking precedence over the second (obviously). How can I find the HWND of the element in the second dialog class:RichEdit20W, rather than the first RichEdit20W in the first dialog?

    This is my code so far:

    Code:
    #include <iostream>
    #include <windows.h>
    
    using namespace std;
    
    int main ( int argc, char * argv )
    {
    	HWND chatwindow;
    	HWND dialog;
    	HWND richedit;
    
    	chatwindow = FindWindowA ( "ChatSkinWnd", 0 );
    	dialog = FindWindowExA ( chatwindow, 0, "#32770", 0 );
    	richedit = FindWindowExA ( dialog, 0, "RichEdit20W", 0 );
    
    	return 0;
    }
    However, it's unfortunately returning the HWND of the first RichEdit20W, rather than the second one


    Any help will be greatly appreciated.

    Thanks,

    Matt N
    Attached Images Attached Images  
    Last edited by guitarist809; 07-02-2008 at 12:54 AM.
    ~guitarist809~

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,854
    Find the edits ID number, it should be constant in every instance of the app.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. find top n elements
    By manzoor in forum C++ Programming
    Replies: 14
    Last Post: 01-03-2009, 04:41 PM
  2. How to fill an ellipse
    By Ducky in forum Windows Programming
    Replies: 4
    Last Post: 08-30-2008, 09:05 AM
  3. sizing problem
    By beene in forum Game Programming
    Replies: 5
    Last Post: 11-14-2006, 02:38 AM
  4. Petzold's HEAD.C
    By cj56 in forum Windows Programming
    Replies: 1
    Last Post: 12-22-2003, 04:15 PM
  5. Outputting String arrays in windows
    By Xterria in forum Game Programming
    Replies: 11
    Last Post: 11-13-2001, 06:35 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21