• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 784
  • Last Modified:

WM_PAINT not sent to descendants?

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
david_johns
Asked:
david_johns
  • 2
1 Solution
 
RuskialtCommented:
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
 
david_johnsAuthor Commented:
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
 
RuskialtCommented:
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

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.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now