comparison 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
comparison
equal deleted inserted replaced
10211:bce48f8324b3 10212:08251403c871
243 snprintf(envstr, 25, "LANG=%s", locale); 243 snprintf(envstr, 25, "LANG=%s", locale);
244 printf("Setting locale: %s\n", envstr); 244 printf("Setting locale: %s\n", envstr);
245 putenv(envstr); 245 putenv(envstr);
246 } 246 }
247 247
248 static BOOL wgaim_set_running() {
249 HANDLE h;
250
251 if((h=CreateMutex(NULL, FALSE, "gaim_is_running"))) {
252 if(GetLastError() == ERROR_ALREADY_EXISTS) {
253 MessageBox(NULL, "An instance of Gaim is already running", NULL, MB_OK | MB_TOPMOST);
254 return FALSE;
255 }
256 }
257 return TRUE;
258 }
248 259
249 #ifdef __GNUC__ 260 #ifdef __GNUC__
250 # ifndef _stdcall 261 # ifndef _stdcall
251 # define _stdcall __attribute__((stdcall)) 262 # define _stdcall __attribute__((stdcall))
252 # endif 263 # endif
291 302
292 if(!getenv("GAIM_NO_DLL_CHECK")) 303 if(!getenv("GAIM_NO_DLL_CHECK"))
293 dll_prep(); 304 dll_prep();
294 305
295 wgaim_set_locale(); 306 wgaim_set_locale();
307 if(!wgaim_set_running())
308 return 0;
296 309
297 /* Now we are ready for Gaim .. */ 310 /* Now we are ready for Gaim .. */
298 if((hmod=LoadLibrary("gaim.dll"))) { 311 if((hmod=LoadLibrary("gaim.dll"))) {
299 gaim_main = (LPFNGAIMMAIN)GetProcAddress(hmod, "gaim_main"); 312 gaim_main = (LPFNGAIMMAIN)GetProcAddress(hmod, "gaim_main");
300 } 313 }