Link to home
Start Free TrialLog in
Avatar of david_johns
david_johns

asked on

WM_PAINT not sent to descendants?

Experts,

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

https://www.experts-exchange.com/questions/21157382/Repaint-Windows-Below-when-a-Dynamicly-Constructed-Dialog-is-Closed.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
ASKER CERTIFIED SOLUTION
Avatar of Ruskialt
Ruskialt
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of david_johns
david_johns

ASKER

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
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 :-)