Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

A Child window of CMDIChildWnd.

Posted on 2003-03-29
14
Medium Priority
?
428 Views
Last Modified: 2013-11-20
I created a child window of a CMDIChildWnd derived class.
It is a just simple CWnd derived window.

The problem begings when I create a child of the CWnd derived window, which is a child of CMDIChildWNd.

The painting and background erase processes are messed up big time!!

When I try to move the window, the background of its parent window, the child of CMDIChildWnd, is not  erasing its back ground leaving the tracks of the path that the window moved along.

Does aybody ahve any idea??
0
Comment
Question by:string6
14 Comments
 

Expert Comment

by:MrNoName
ID: 8232462
You are probably not providing a window class for it

Override the PreCreateWindow virtual function

BOOL CYourClass::PreCreateWindow(CREATESTRUCT& cs)
{
        if( !CMDIChildWnd::PreCreateWindow(cs) )
          return FALSE;

     cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
     cs.lpszClass = AfxRegisterWndClass (CS_DBLCLKS, AfxGetApp ()->LoadStandardCursor (IDC_ARROW),
          (HBRUSH) (COLOR_3DFACE+1), AfxGetApp()->LoadStandardIcon (IDI_WINLOGO));

     return TRUE;
}

Notice the call to AfxRegisterWndClass. The problem you are encountering could be caused by a NULL call...like this: AfxRegisterWndClass (0)
0
 

Author Comment

by:string6
ID: 8232754
The thing that I don't understand is why it does not happen if I create a child window in a regular CWnd derived window , not CMDIChildWnd derived window.

Could you educate me little bit please?
0
 

Author Comment

by:string6
ID: 8232755
By the way, I have not had a chance to try your recommendation yet.  I will post the result after I try.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:string6
ID: 8232763
One more thig,

The window which is not painting and erasing its back ground is a CWnd derived window contained in CMDIChildWnd derived window.
0
 

Expert Comment

by:mjwilliamson
ID: 8238083
Why don't you use a CMDIFrameWnd class and the doc/view
architecture. This will handle the Child window for you.

0
 

Author Comment

by:string6
ID: 8238717
I am using CMDIFrameWnd class for the container of CMDIChild.  I cannot use doc/view due to the nauture of project
0
 

Expert Comment

by:mjwilliamson
ID: 8238800
what are you trying to achieve with this CWnd window?
0
 

Author Comment

by:string6
ID: 8238838
It is going to have buttons in it, and the user should be able to move it arouund.
0
 

Expert Comment

by:mjwilliamson
ID: 8238940
If the new window is to be a child of the child window,
then I pressume that it is a toolbar or floating bar
you are after. You could add a toolbar to the childFrame
class and load a toolbar the conventional in Create().

This can be docked perminently at the top of the child
window which would keep things tidy or you could float
it at a particular location on the screen. This should
also take care of the erase background or whatever the
problem was.

Hope this helps
0
 

Author Comment

by:string6
ID: 8239014
Unfortunatly that is not the case.

It is a cbutton drived button I have to have in a window, which is contained in a CMDIChildWnd derived class.
0
 

Expert Comment

by:mjwilliamson
ID: 8239044
Does it have to be a CButton object you use?
0
 

Author Comment

by:string6
ID: 8239090
Yes......  I have no choice......

I was given a mfc extesion dll that creates button as requested.  I have to make a button page editor in MDI evironment......

I think in CMDIChildWnd case, CMDIChildWnd is resoposible to paint and erase background of its child windows....

It sort of works if I force to invalidate the CMDIChildWnd class.

 
0
 

Author Comment

by:string6
ID: 8271759
I will get this question deleted and get the point refunded.

I any body have opposition to it, please post iwthing 4 days.

Thanks
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 8295004
PAQ'd and all 200 points refunded.

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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…
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.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

564 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