I have an application with following windows hierarchy:
W1
-W2 (Child of W1)
- W3 ( Child of W2)
--------------------|
| W1|------------| |
| |W2 |------| | |
| | |W3 | | |
| | |------| | |
| |------------| |
|-------------------|
When certain event happens in W2, I call UpdateWindow
:
W2::onCertainEvent()
{
Invalidate(NULL);
UpdateWindow();
}
The OnPaint
handling of W2 looks like this:
W2::onPaint()
{
//W2 logic goes here
W3.Invalidate(NULL); //So that paint messages are given to W3
}
But some times the paint messages are getting lost in W2. Though UpdateWindow
gets called, there is no corresponding OnPaint
() getting called.
If I add a property WS_EX_TRANSPARENT
to W1 ( the parent of W2) then always paint messages are received @ W2.
But the problem with adding the WS_EX_TRANSPARENT
flag is that it creates lot of flicker when I resize the window W1.
My Questions are:
1. What is wrong in W2 so that Paint messages are lost?
2. Why adding WS_EX_TRANSPARENT
solves the Paint problem.
3. How do I solve flicker issue if the flag is used.
Thanks,