Solved

How do I get my child window of a CWnd object to display?

Posted on 1998-01-28
2
356 Views
Last Modified: 2013-11-19
I know I'm most likely missing some fundamental knowledge here, but I have a CWnd object (unfortunately, it's not a CMDIFrameWnd or even a CFrameWnd), can I create a visible child using Create() or CreateEx()?  I create an instance of an oject derived from CWnd, and the call its Create() function giving it a parent.  I then call show and update, I declare the window style as WS_CHILD | WS_VISIBLE so I'm not sure I need to do this, but anyway I don't see the window.  I'm not sure how MFC handles the message loop.  Is is running in CWinThread?  Do I need to create my own so that the window will update? I've been used to dealing with only MDI child windows and never had to implement this stuff with MFC.  Any help would be greatly appreciated.

Thank you.
0
Comment
Question by:jmaresca
2 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 160 total points
ID: 1315094
Did you specify a valid visible rectangle for the window? You should double check to see if the window has been created or not by using Spy++. With Spy, you can see if the window was actually created and its location. From that, you should at least see if the window has been create or not.

If you call Create and it returns TRUE, then you can be sure that the window creation succeeded. So I suspect it is probably off the screen or clipped by the window somehow.
0
 

Expert Comment

by:krw
ID: 1315095
I struggled with this one for a while before I figured out what I was doing wrong.  If your application is an MDI one (as mine was in the same scenario), your child window must be derived from CMDIChildWnd to interact with the framework correctly.  CWnd, nor CFrame will work; they will be created but obscured by the CMainFrame window.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now