Icon question

Hi Jules!

I have created an audio plugin that creates an instance of a DocumentWindow.

The DocumentWindow shows as a separate icon in the windows taskbar (good!) but doesn’t show the application icon (i.e. just shows the windows default for a dll - bad!).

I can’t figure-out what to do about this with Juce; the Win32ComponentPeer stuff is all private to Juce, so I can’t see that I can set the icon without hacking Juce directly.

NB if I call setIcon on the DocumentWindow, I get an icon shown in the Juce titlebar, but this icon doesn’t show in the Windows titlebar (if I show native title bar) or in the taskbar item.

Can you please let me know what I need to do I need to do to get this working? :slight_smile:

Many thanks in advance,


Might involve a bit of hacking - if you build an app, it picks up the icon from the exe (in the windowing code, line 1038), and I’d expect that to get the DLL and pull the icon out of it, so not sure why it would fail…? Maybe do a bit of tracing and check that it’s got the correct module handle when it hits that line?

Many thanks Jules, I’ve hacked around and yes, the problem is that the hinstance is (AFAIK) that of the sequencer (e.g. Cubase or Sonar). So, it doesn’t use the .ico resource from the DLL.

This would be a common problem for any win32-based plug-in using Juce, that creates a child DocumentWindow that it wants to show on the desktop, i.e. I’m probably not the only person seeing this with Juce. :slight_smile:

This seems to imply that the solution might be to modify setIcon on DocumentWindow… to do something like:
call into the Win32ComponentPeer…
to ask it to call setIcon for the window handle…?

Does that make any sense?!


Hmm - that’s odd, because in the VST startup, it should be setting the module handle correctly. Line 1547 of juce_VSTWrapper.cpp. You’re not bypassing that somehow, are you?

Just double-checked, that line is definitely called.

    if (dwReason == DLL_PROCESS_ATTACH)
        PlatformUtilities::setCurrentModuleInstanceHandle (instance);

All very puzzling…!

But if the hinstance is that of the host, you’d expect the window to get the host’s icon… (?)

Err… well, yes… but that is what the VST wrapper code does… are you saying that I should modify this to pass-in the DLL hinstance instead?
I’m feeling dense, I’ve had a tough 24 hours fighting Sonar (and losing!)