Using JUCE Widgets in another application

Hi Jules,
I want to use juce widgets in another application, so as you have mentioned in the Documentation , i have done like this

juce::initialiseJuce_GUI(); juce::PlatformUtilities::setCurrentModuleInstanceHandle(hWnd);

But when i show the Button like this , it is not attaching to the window.

juce::TextButton* pButton = new juce::TextButton("dad", ""); pButton->setVisible(true); pButton->addToDesktop( juce::ComponentPeer::windowIsResizable , hWnd); pButton->setBounds(10, 10, 200, 200); pButton->setLookAndFeel(&juce::LookAndFeel::getDefaultLookAndFeel());

i think i should not say addtoDesktop(), but not sure what method to use to attach to the Window.
So please tell me how to use the widgets in another application windows.

Mixing up windows that are created and managed by different frameworks is always going to be a nightmare, I should warn you! You certainly shouldn’t be using the resizable window flag for a child window, but other than that, I’ve no idea what could be going wrong - you need to get in there with your debugger and do some digging…

Hi Jules,
I thought , there is an option in juce to use the widgets in another applications…

So, when should we use like this


I tried to do as you have done in OpenGLComponent
I created a base component in which i am keeping the TextButton as child.
I created a peer in that base component and attached the main window handle as a parent to the peer handle

It is attaching the component , but it is not doing any repaint on mouse over. When i debug i noticed that the component flag flags.hasHeavyweightPeerFlag should be true to do any repainting or to handle any mouse events. I mean even the mouse even comes to peerWindowsProc(), while checking for whether the component contains the x and y , it returns false as there is no parent component as well as the component hasHeavyweightPeerFlag is false…

Please check and tell some solution…

Not explicitly… Sure, you can do some platform-specific hacks to embed a juce window in another window, but that’s not a ‘feature’ of the library, and I can’t guarantee that it’ll actually work!

If you want an example to follow, you should look at the audio/browser plugin code - that’s where it’s embedding a juce window in another one. The opengl comp is the wrong way round - it’s embedding another window in a juce one.

Thanks Jules, I didn’t build audio plugin but i got the sample to see how to use…