Standalone JUCE program start (SOLVED)

I've noticed strange thing with JUCE standalone programs on Windows (JUCE demo for example) - JUCE versions 3.1 and 3.2. 

I can reproduce it with my standalone app as well.

When program starts, it doesn't display its window at the top of other windows . Instead, its blinking icon appears in the status line. Click on the icon puts the window to the front and program works normally. Like program would be put in the background when started ?!?

In very rare cases program starts normally, but icon is blinking nevertheless - setting Shortcut's "Run" option has no effect on this behaviour.

Windows 7 x64 here.

Any ideas?


Have you tried this with juce 4.1?

There are documentWindow methods that can move an application window to the front

I'll try with 4.1 as well.

Strangely, JUCE Plugin Host doesn't suffer from this issue - can't tell why - it is also based on Document window and main window code looks pretty much the same as in JUCE demo or my app.

“Pretty much the same” isnt “exactly the same” tho. I’d compare it line by line with your code.

I've just check all possible code differences (regarding startup and main window creation) between my JUCE standalone app / JUCE demo and JUCE Plugin Host.

Just can't find what could be the reason for Plugin Host to work correctly and others don't. Plugin host main window is always displayed at the top when program is started. My program and JUCE Demo are displayed in the background.

Anyone ?


I finally found the reason for this misbehaviour!

I had the following code inside main DocumentWindow constructor ...

setUsingNativeTitleBar (true);

Now, I've moved it to application'a Initialise function and suddenly everything works as expected.

mainWindow->setUsingNativeTitleBar (true);

The same solution applies to JUCE Demo program !

Any comments on this ?

only way to really know is to set some breakpoints and see what happens inside the juce_application classes when this method is called from initialise() vs your documentWindow class

Yes, i agree, that would be logically the only way to find out exactly what's going on ... but ... maybe someone already did this and knows the answer - that's why the forums are so useful =:) I won't dig into this any more (not enough time) since it is working now ...