?
Solved

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

Posted on 1998-01-28
2
Medium Priority
?
371 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 480 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

770 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