VST in VST on Windows, guest editor z-index

Hey coders! So I am hosting a VST in VST. The HostPluginDemo was a good jump start.
What I noticed is that it uses ScaledDocumentWindow for the guest VST editor and as it is a top-level desktop window it has to be set to stay on top in order to not get obscured by the DAW window once the hosting VST editor gets focus.

What I want to achieve is to have the guest VST editor as a child of the DAW window as well as the host VST is. The way it is done now the guest VST editor window stays on top always overlaying the host editor window, while I need to switch between the host and guest editors and have them stack according to their focus. And when I focus the DAW i need both editors to stay visible.

I tried to set the guest editor window’s parent directly using win32api like this

    auto window = std::make_unique<ScaledDocumentWindow>(bg, currentScaleFactor);
    window->setContentOwned(editorComponent.release(), true);

#ifdef _WIN32
    if (auto* thisPeer = getPeer())
    {
        HWND thisHwnd = (HWND)thisPeer->getNativeHandle();
        HWND parentHwnd = GetParent(thisHwnd); // Get Bitwig’s window (or closest parent)
        if (parentHwnd && window->getPeer())
        {
            HWND guestHwnd = (HWND)window->getPeer()->getNativeHandle();
            SetWindowLongPtr(guestHwnd, GWLP_HWNDPARENT, (LONG_PTR)parentHwnd);
            SetWindowPos(guestHwnd, HWND_NOTOPMOST, 0, 0, 0, 0, 
                         SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
        }
    }
#endif

But GetParent(thisHwnd) returns HWND of the hosting VST’s editor, so no luck yet.

If anybody has any suggestion how to hack it, I’d be grateful. Otherwise I will have to live and design with that stay-on-top in mind.

Cheers!

The HostPluginDemo also shows how to display the editor inside the editor window provided by the DAW. The “Open In This Window” button will re-use the existing window, while the “Open In New Window” button will create a new window to display the inner editor.

Yes, I know. What I need are separate editors as the guest VST editors vary in sizes and I need to keep my UI uncluttered. But thank you for your quick response!