Solved

WM_PAINT not sent to descendants?

Posted on 2004-10-15
4
743 Views
Last Modified: 2013-11-20
Experts,

I recently discovered the true answer to the question I asked in a recent post:

http://www.experts-exchange.com/Programming/Programming_Languages/MFC/Q_21157382.html

The actual problem was that the m_pMainWnd of the application was the owner of these popup windows.  When it closed evidentally the parent window did in fact repaint, but the children (who cover most of the parent) did not.  It seems that WM_PAINT messages were not relayed from the parent to the child.  I would have thought that MFC would automatically send this message along to them.  I was able to easily send it myself, since I had already overridden the WindowProc as follows:

//Broadcast custom defined messages to all windows
if(message>=WM_APP && message<=0xBFFF){
      SendMessageToDescendants(message, wParam, lParam, TRUE, TRUE);
}

return CDialog::WindowProc(message, wParam, lParam);

This wouldn't have interrupted the sending of WM_PAINT to descendants.

I really would have thought that MFC would take care of this itself.  Have I messed something up that prohibits it from doing this or are you really required to do this yourself using a method like the one above?

Thanks,
David John
0
Comment
Question by:david_johns
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
Ruskialt earned 50 total points
ID: 12372682
I can't find a reason for ever posting a paint message. You can call Invalidate() on the window that need repainting, and the system will shortly send paint messages for display updates. I don't think paint message have to come from the parent. Paint messages are also send to windows if you draw another window over it. The system usually takes care of who need be repainted...
0
 

Author Comment

by:david_johns
ID: 12561667
Experts, DanRollins,

I recommend to delete the question since no answer was ever given.  Unless I am just not reading between the lines, Ruskialt's comment just said that this should never happen, but did not propose a way to fix the problem I am having.  If someone wants to make a more directive statement on what I need to do I am happy to accept it and reward them with the points.

Thanks,
David
0
 
LVL 2

Expert Comment

by:Ruskialt
ID: 12563054
Fair enough, my statement won't help you much except for confirming to you that you are probably on the wrong track, since you should never have to send paint messages. Some questionable design decisions are probably to be found elsewhere in your application - hard to say where.

No harm cancelling the points :-)
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sum13 challenge 24 105
haveThree challenge 22 116
scoreUp challenge 14 61
firstChar challenge 13 114
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

813 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

14 Experts available now in Live!

Get 1:1 Help Now