Solved

WM_PAINT not sent to descendants?

Posted on 2004-10-15
4
732 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

757 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

22 Experts available now in Live!

Get 1:1 Help Now