Next time please post non-mFC questions in C++ and WinAPI forum.
How is the hierarchy ? Like below ?
If so, that is bound to happen, because there is no restricting the child window because child window is entitled to whole of the mainwindow and so does toolbar window.
What you could do is, create toolbar as child of main window. Create another dummy window as child of mainwindow which occupies all space apart from toolbar space. Create ChildWindow as child of this dummy window