I have an application that I want to have only one instance running. I have the following code that is able to detect the 2nd instance but I am having trouble passing the command line parameter from the second application to the first.
Code: Select all
#include <wx/snglinst.h>
void Application_Dialog::OnInit(wxInitDialogEvent& event)
{
wxSingleInstanceChecker m_oSingleInstanceChecker;
if (m_oSingleInstanceChecker.IsAnotherRunning())
{
if (wxTheApp->argc > 1)
{
// pass this into first instance wxTheApp->argv[1]);
wxTheApp->ExitMainLoop(); // exit this second instance
}
}
}
Example of what should happen.
1. First instance is started
2. Second instance is started
3. The command line parameter from 2nd instance is passed into 1st instance
4. 2nd instance exits
Does anyone have any ideas on how I would achieve this?
Thanks in advance.