Thread: MFC :: Finding Child Window of a CWnd* Object?

  1. #1
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Question MFC :: Finding Child Window of a CWnd* Object?

    Okay, I am making a small application that retrieves the conversation text from the AOL Instant Messenger application. I type in the user's screen name of the window to monitor, and that works alright. Now, I need to get a CWnd* object to the RichEdit child window. It is finding the parent IM window as it should. Also, the class name of the child window is Ate32Class, which I got from the Spy++ MSVC++ tool. When I do this:

    Code:
    		m_pChild = m_pWnd->FindWindow("Ate32Class", NULL);     // Find child window
    		if (! m_pChild)      // Error finding text window?
    		{
    			AfxMessageBox("Error finding conversation text window!\n");   // Display error message
    			return;     // Exit function
    		}
    It shows me the error message. It isn't finding the child window of parent 'm_pWnd'. If you can give me any help, please do.

    Thanks,
    Matt U.

  2. #2
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    FindWindow() only finds top-level windows. You may need to use FindWindowEx().
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  3. #3
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Lightbulb Nevermind, I got it :-D

    I found it out. I just had to do this:

    Code:
    		m_pChild = m_pWnd->GetNextDlgGroupItem(m_pWnd);
    		m_pChild = m_pChild->GetNextDlgGroupItem(m_pWnd);
    :-D

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Creating a child window in a parent window
    By vopo in forum Windows Programming
    Replies: 8
    Last Post: 10-06-2007, 04:15 PM
  2. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  3. Parent not repainting Bitmp after child window closes
    By CodeX in forum Windows Programming
    Replies: 5
    Last Post: 10-05-2006, 12:03 AM
  4. Get a pointer to a 3rd level child window
    By axr0284 in forum Windows Programming
    Replies: 4
    Last Post: 01-30-2005, 01:29 PM
  5. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 04:10 AM