I'm currently writing a GUI application using a self-made wrapper for Win32 windows and controls. I have made a custom class, which is supposed to act as a container for children controls. The problem is that my custom control is drawn on top of the children controls, which makes them invisible.
I've added the WS_CLIPCHILDREN
flag to my container, but the problem still persists.
CodePudding user response:
As Jeromy Adofo pointed out, the problem was related to Z-ordering.
I used SetWindowPos()
(MSDN page here) and passed the first two arguments like this : SetWindowPos(childHwnd, parentHwnd, ...);
and it worked.
Just another thing, SetWindowPos()
asks for the child's position and size. If these values are already set for you, and you don't want to pass them again, use the flag combination SWP_NOMOVE | SWP_NOSIZE
and set the position and size parameters to zero.