I’m wondering if there’s a blanket way to disable any gui windows from popping up in a gui app, just like how the console app “intrinsically” does it.
Basically, I’m hosting plugins in the gui app (because I need the message thread to work for async updates and what not) but I don’t actually want any gui elements opening.
Take a look at MessageManager::runDispatchLoopUntil. You can call this in a loop and will basically have messaging up and running. We use it for unit tests that run without GUI.
luzifer this is splendid thanks! For anybody looking into this here’s some setup code below (in the Main.cpp file generated from a Juce Console App project)
/*
==============================================================================
This file was auto-generated!
It contains the basic startup code for a Juce application.
==============================================================================
*/
#include "../JuceLibraryCode/JuceHeader.h"
class Tick : public Timer
{
public:
Tick()
{
startTimer(1000);
}
void timerCallback() override
{
DBG("timer");
}
};
//==============================================================================
int main (int argc, char* argv[])
{
// init message manager and message queue
MessageManager::getInstance();
{
// add timer (uses message loop)
Tick t;
// run message loop
MessageManager::getInstance()->runDispatchLoopUntil (5000);
}
// avoid TimerThread leak assertion
DeletedAtShutdown::deleteAll();
// avoid MessageManager leak assertion
MessageManager::deleteInstance();
return 0;
}
I’ve encountered an issue with this setup, just wanted to check if anybody has some knowledge on the matter.
My dev machine is running OS X 10.11 and thus I compile my projects in Xcode using the 10.11 OS X SDK (but with a OS X 10.7 Deployment Target setting).
The reason I’m using a console app to do some background rendering is because I don’t want any ui elements appearing & I don’t want to have to write code (most likely macros) to manually disable the ui stuff.
This works fine when running the executable in 10.11 but when my coworker runs it in 10.10, it crashes when attempting to run the ui loading code: