Solved

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

Posted on 1998-01-28
2
367 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Importing Special Characters in Dynamics GP Through Integration Manager 3 82
centeredAverage challenge 8 179
either24  challenge 19 101
wordappend challenge 8 200
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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…
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.

839 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