Load a JUCE component in a non-JUCE parent application

I am using JUCE for audio processing inside a non-JUCE application. I’ve done this by creating a static library in Projucer, which then exposes a non-JUCE interface to the parent application. This all works fine.

I would now like to provide a window to my static library that my JUCE code can add a Component into. Is this possible? E.g. by passing a HWND or NSViewComponent somehow…?

This sounds similar to the way that plugin UIs work, so you could check out the Editor classes in the VST/AU wrappers to see what they do. In short, you can pass a native window handle into Component::addToDesktop, and the component will then display inside the specified window.

3 Likes

Awesome, I was wondering the same.

Does that mean in case of windows, that the WS_CHILD is added automatically to the ComponentPeer::StyleFlags?

Since I cannot spot a flag that sounds related…

1 Like

Yes, in the HWNDComponentPeer it looks like we automatically add the WS_CHILD flag if the parerentToAddTo is not nullptr.

1 Like

Nice, thanks. I will have a play with it soon.

@reuk Great stuff. Thanks for the quick reply.