ExtractAssociatedIcon freeze

the juce_win32_Windowing.cpp contains a WindowClassHolder class. In it's constructor it calls ExtractAssociatedIcon twice to fill in the extended window class. This function seems to freeze my application on start up. The weird thing is that if i pause the debugger (MSVS) and then continue again, everything seems to work fine. If i change the calls to just NULL the startup is going fine aswell, i dont know what this would to to the icons we'll eventually add though.

I'm using Windows 8.1 x64, but have no idea where to start searching, any clues?

That's pretty bizarre! It's very old code that has been running happily for years, including on Win8. 

Maybe something is strange or broken in your exe, and the OS is struggling to parse the file correctly?

Yeah maybe it doesn't like that i dont have any Resource.rc file in the project, maybe it doesn't like the fact that there isn't any icon to retreive. I'll see if i can add that and check again.

Reading up on https://msdn.microsoft.com/en-us/library/windows/desktop/ms648067%28v=vs.85%29.aspx it makes a remark saying that the returned icon handle needs to be DestroyIcon'ed. Shouldn't the WindowClassHolder do this on destruction?

I vaguely remember having to deliberately avoid destroying it because it was causing problems, maybe with a very old version of Windows or something.. Either way there's very little harm in leaking it, since the WindowClassHolder will live until your app is closed, and it's only a tiny icon handle that's being held.

If you destroy the icon before you're done using the window class than the windows using that class dont show the icon in their titlebar. That's why it should be at destruction, but as you said, the icons are very small (32x32 and 16x16 or something) so i'm not too worried.

Anyway, after adding a resource file including a dummy icon i dont get this problem anymore. Since i only had a single icon for testing purposes i needed to use the index of the first icon also for the small icon, but i'll be adding multiple icons so that it would work as intended.

Thanks for thinking with me :)