If you are writing applications to run as services under FireDaemon utilising the wxWidgets library, you may run into problems when the application is shut down by FireDaemon Pro. The symptoms will be that FireDaemon Pro kills off the application because it (apparently) does not respond to WM_CLOSE. This symptom is evident for any third-party application attempting to shut down a wxWidgets based application.


The reason is that a wxWidgets application will only process the WM_CLOSE if the application itself has focus (which is not normally the case - especially if you are shutting down the service via the FireDaemon Pro GUI). To make it work you will need to add the following code to your main window:

WXLRESULT MainFrm::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
{
// For some reason wxWindows don't respond to WM_CLOSE
// calls from outside the application (it seems the
// application must have focus to process this message),
// so we manually exit the application.
if (message == WM_CLOSE)
TheApp->ExitMainLoop();

return wxFrame::MSWWindowProc(message, wParam, lParam);
}


Alternately, you could use a FireDaemon post-service event that runs your own hand-rolled program to locate the top-level window of the application in question and then injects WM_ACTIVE followed by WM_CLOSE messages into the application's message queue.