Messageboxes suppressed by Juce?


#1

Hello,

firstly - thanks for the great platform. I've nearly transitioned totally, however, there are a couple of issues. I used the introjucer to create a audio plugin project which i then built my existing project out from.

I have my own api for creating messageboxes, but (at least on windows) when i spawn messageboxes, they do not appear - but still block the main gui. They appear if i press 'alt' for some reason.

What gives?

 

Regards


#2

No.. there's nothing I can think of that would interfere with that. Maybe your boxes are just behind other windows, e.g. are the other windows always-on-top?


#3

Nope.. On windows i use the native MessageBox() api btw. I can't seem to reproduce the problem with my old source (pure vst plugin).

If i spawn the messageboxes asynchronously, ie. in another thread, they work fine.

 

Another thing, the program crashes if i close the plugin while the messagebox is hidden - but i guess i have to lock it with a mutex, so the plugin doesn't get deleted meanwhile.

 

Edit: another thing, my plugin spawns another window, which can make messageboxes without problems.


#4

If you're doing a plugin then don't run any modal loops! I'm so tired of repeating this, I can't bear to type out all the reasons for it yet again.. I should probably write some kind of sticky post or article about it.

In your particular case your problem is probably just that you're calling win32 GUI functions on a background thread that hasn't been initialised as a GUI thread. But do NOT fix it by messing about with win32 functions to force the threading to work - the only sensible fix would be to remove all modal loops from your plugin, and embed any message boxes inside your plugin's editor, not in floating windows.


#5

Huh.

Well im sorry if i ruined your evening :(


#6

Sorry if my comment sounded a bit more grumpy than it was intended to! But please heed the advice - plugins with pop-up windows are a bad idea for everyone: annoying for users to dismiss when scanning or loading projects; a total nightmare for us host-writers to deal with; and it'll cause horrible subtle bugs for you if you run modal loops. Please don't do it!


#7

Yes, i understand all the reasons. However this seems to not only be for audio plugins. Looking at the juce code in juce_gui_basics.cpp, it seems something about your WM_PAINT handler is incorrect.  There are certain cases (like for the reentrant code you commented yourself in case of messageboxes) where it is more appropiate to return DefWndProc() instead - this solves all problems i've had.


#8

The WM_PAINT stuff has been pretty rock-solid for years now - which bit exactly are you talking about?