[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 1998-01-28
2
Medium Priority
?
379 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 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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.
Loops Section Overview
Suggested Courses
Course of the Month20 days, 14 hours left to enroll

810 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