I tried to terminate Juce Application from another application using WM_QUIT message, but the Juce Application doesn’t exit. I think it should exit when receives the WM_QUIT message.
In my Juce application, I set T(“MyJuceApp”) for my top level window.
In the “terminator” application, I do following.
void Test()
{
// works fine, I can terminate NotePad.exe with success.
PostMessage(FindWindow(L"Notepad", NULL), WM_QUIT, 0, 0);
// failed
PostMessage(FindWindow(NULL, L"MyJuceApp"), WM_QUIT, 0, 0);
// failed
PostMessage(FindWindow(NULL, L"The Jucer"), WM_QUIT, 0, 0);
}
I have confirmed all those window handle is valid.
Good point. It responds to WM_CLOSE, but I never made it handle WM_QUIT. It’s an easy one to add, though. I’ve checked in a new version now that should be ok.
Shouldn’t the WM_QUIT handler be in the juce_dispatchNextMessageOnSystemQueue ? If I do a “::PostQuitMessage(0)” in a buttonClicked handler, nothing happens with the latest git juce. However, if I modify juce_dispatchNextMessageOnSystemQueue, it works as expected: