diff src/win_gaim.c @ 10212:08251403c871

[gaim-migrate @ 11336] Both the installer and gaim make checks to see if an instance of gaim is already running. committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Sat, 20 Nov 2004 00:42:42 +0000
parents 4d3c2749deec
children 53c9ba039354
line wrap: on
line diff
--- a/src/win_gaim.c	Fri Nov 19 22:52:47 2004 +0000
+++ b/src/win_gaim.c	Sat Nov 20 00:42:42 2004 +0000
@@ -245,6 +245,17 @@
         putenv(envstr);
 }
 
+static BOOL wgaim_set_running() {
+	HANDLE h;
+
+	if((h=CreateMutex(NULL, FALSE, "gaim_is_running"))) {
+		if(GetLastError() == ERROR_ALREADY_EXISTS) {
+			MessageBox(NULL, "An instance of Gaim is already running", NULL, MB_OK | MB_TOPMOST);
+			return FALSE;
+		}
+	}
+	return TRUE;
+}
 
 #ifdef __GNUC__
 #  ifndef _stdcall
@@ -293,6 +304,8 @@
                 dll_prep();
 
         wgaim_set_locale();
+		if(!wgaim_set_running())
+			return 0;
 
         /* Now we are ready for Gaim .. */
         if((hmod=LoadLibrary("gaim.dll"))) {