diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc index ab85302782..37828482e7 100644 --- a/gtk2_ardour/main.cc +++ b/gtk2_ardour/main.cc @@ -70,6 +70,7 @@ #include "pbd/i18n.h" #ifdef PLATFORM_WINDOWS +#include // CreateMutex #include // Needed for '_fmode' #include // console #endif @@ -337,6 +338,17 @@ int main (int argc, char *argv[]) << endl; } +#ifdef PLATFORM_WINDOWS + CreateMutexA (0, 1, string_compose ("%1%2", PROGRAM_NAME, PROGRAM_VERSION).c_str ()); + if (GetLastError() == ERROR_ALREADY_EXISTS) { + Gtk::Main main (argc, argv); + Gtk::MessageDialog msg (string_compose (_("%1 is already running."), PROGRAM_NAME), + false, Gtk::MESSAGE_ERROR , Gtk::BUTTONS_OK, true); + msg.run (); + exit (EXIT_FAILURE); + } +#endif + #ifdef HAVE_DRMINGW /* prevent missing libs popups */ UINT prev_error_mode = SetErrorMode (SEM_FAILCRITICALERRORS);