[C++ - win32] - how make a child control always on top?

i tryied several ways and nothing works perfectly(i found 1 way that gives me a 'flicker').
i have 2 child controls:
1 - label: that uses a timer for animation(using Invalidate());
2 - a tooltip: when is showed, the control is on top most. but when the label is re-painted, isn't on top most.

so what is the best way for put a child control always on top?
ahcfan i did that. but works fine until the other control is re-paintted
Last edited on
Hmm I'm not sure then in that case. If you're not doing any weird custom drawing then I would think the label should retain its Z order.

How are you animating the label exactly? Are you doing some custom drawing?
nothing about Z-order, i belive. if i use a timer with SetWindowPos(), will be ignored. if i do ShowWindow() with SW_MINIMIZATE and then with SW_RESTORE(using a timer), i get like a flicker, but works.
finally works fine:
1
2
3
4
5
6
7
case WM_WINDOWPOSCHANGED:
            {
                LPWINDOWPOS lpwp = (LPWINDOWPOS)lParam;
                if(IsWindowVisible(inst->hwnd)==true && lpwp->hwndInsertAfter != HWND_TOPMOST)
                    SetWindowPos(inst->hwnd, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE);
            }
            break;

the WM_WINDOWPOSCHANGED message is activated, too, when the Z-Order is changed.
after more tests i found 1 strange thing: the MSND tells us for return TRUE, when we must do a transparent control(and for avoid the flicker). but, by some reason, the it can change the Z-Order. why these happens?
Topic archived. No new replies allowed.