VSTPluginWindow and native child windows


I have a plugin, which is hosting multiple VST plugins. They are all displayed at the same time in a rack format.

There is one thing i don’t understand, though, so let me explain, i am afraid it is a bit complicated …
NOTE: this is happening only on Windows.

There are multiple VSTPluginWindow instances loaded in my plugin. Each VSTPluginWindow contains pluginHWND variable which contains native window (plugin editor)

pluginHWND = GetWindow ((HWND) getWindowHandle(), GW_CHILD);

So basically pluginHWND is a VSTPluginWindow’s native child window. According to this logic, each VSTPluginWindow has exactly one native child window.

Now comes something interesting …

This works OK with one instance of VSTPluginWindow. But, when i add another VSTPluginWindow, it contains its own child window as expected but at the same time it contains also child window of the previously created VSTPluginInstance!!??!!. Previous line of code always finds the child window, which was created first, regardless to which VSTPluginWindow it belongs.

Because of this, i have to find correct child window for particular VSTPluginWindow before displaying it (using folowing function)

pluginHWND = GetWindow (pluginHWND, GW_HWNDNEXT);

I really don’t understand, why every VSTPluginWindow instance contains all previously created native child windows, from every other VSTPluginWindow in my plugin.

I hope this explanation is clear enough.

Any ideas, suggestions, am i missing something ??


I’ve came to conclusion, that using multiple VSTPluginWindows in the single parent window is simply not possible by default. And looks like this GetWindow GW_CHILD approach is the reason for this …

As i said, i’ve solved this issue my way, but i would really like to know if there is more elegant solution possible.