I have an existing Windows application and I’m using JUCE to add VST support to the application. It’s working really great (!!) except for 2 issues, one of which I’ve solved and one of which I haven’t. NOTE: I’m using the current developer branch of the software.
When we create the effect, a new MessageManager() gets created. When we call createEditorIfNeeded() to show the editor window., a new Desktop gets created.
The MessageManager is easy to destroy – we simply call MessageManager::deleteInstance() and it frees itself properly.
The problem is that there doesn’t appear to be a way to destroy the Desktop. The Desktop inherits privately from DeletedAtShutdown, so we cannot call the Desktop::deleteAll() function. Since this isn’t a JUCE application, there doesn’t appear to be any way to delete the Desktop object.
I changed the inheritance of DeletedAtShutdown from private to public, then called Desktop::deleteAll(), and everything cleans up perfectly – no memory leaks at all on shutdown. So I would suggest you change this in the dev code, unless there’s another way I can delete the desktop that I haven’t discovered yet?
This one seems a little harder. After we call createEditorIfNeeded(), we’re adding the editor to our own class that extends ResizableWindow, pretty much identical to how its done in the “Plugin Host” demo. This ResizeableWindow then gets added to the Desktop, which allows us to call getWindowHandle() (or getPeer->getNativeHandle()) to get a Windows handle to the window, and we can then add the window as a child window into our application.
This works great overall, but there’s a problem. The ResizableWindow, when it is added to the desktop, creates an entry on the Windows taskbar. The constructor for ResizableWindow() takes an addToDesktop flag. If I set this flag to false, and then call Component::addToDesktop myself and pass in 0 for the flags, the window still gets added to the taskbar. I stepped into the code to try to find out why this is happening. It appears that the peer is initially created with the flags that I pass in, but then there are several subsequent calls to addToDesktop, all made by the drop shadow (even if its disabled). Each of these calls to addToDesktop() calls TopLevelWindow::getDesktopWindowStyleFlags() to decide on the flags, and TopLevelWindow::getDesktopWindowStyleFlags() ALWAYS sets the styleFlag to “windowAppearsOnTaskbar” – there’s no flag for this.
There must be some way I can create a resizable window that isn’t on the taskbar, right? I’d certainly appreciate some guidance!
Thanks once again!