Mercurial > pidgin
changeset 21980:46a9fc98402e
This is how the error handling for the win32 single instance mutex is supposed to work.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Fri, 04 Jan 2008 01:10:09 +0000 |
parents | 26648115261c |
children | 9573b81d5735 |
files | pidgin/win32/winpidgin.c |
diffstat | 1 files changed, 14 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/win32/winpidgin.c Fri Jan 04 01:09:13 2008 +0000 +++ b/pidgin/win32/winpidgin.c Fri Jan 04 01:10:09 2008 +0000 @@ -450,23 +450,25 @@ if ((h = CreateMutex(NULL, FALSE, "pidgin_is_running"))) { DWORD err = GetLastError(); - if (err == ERROR_ALREADY_EXISTS && fail_if_running) { - HWND msg_win; + if (err == ERROR_ALREADY_EXISTS) { + if (fail_if_running) { + HWND msg_win; - printf("An instance of Pidgin is already running.\n"); + printf("An instance of Pidgin is already running.\n"); - if((msg_win = FindWindowEx(HWND_MESSAGE, NULL, TEXT("WinpidginMsgWinCls"), NULL))) - if(SendMessage(msg_win, PIDGIN_WM_FOCUS_REQUEST, (WPARAM) NULL, (LPARAM) NULL)) - return FALSE; + if((msg_win = FindWindowEx(HWND_MESSAGE, NULL, TEXT("WinpidginMsgWinCls"), NULL))) + if(SendMessage(msg_win, PIDGIN_WM_FOCUS_REQUEST, (WPARAM) NULL, (LPARAM) NULL)) + return FALSE; - /* If we get here, the focus request wasn't successful */ + /* If we get here, the focus request wasn't successful */ - MessageBox(NULL, - "An instance of Pidgin is already running", - NULL, MB_OK | MB_TOPMOST); + MessageBox(NULL, + "An instance of Pidgin is already running", + NULL, MB_OK | MB_TOPMOST); - return FALSE; - } else + return FALSE; + } + } else if (err != ERROR_SUCCESS) printf("Error (%u) accessing \"pidgin_is_running\" mutex.\n", (UINT) err); } return TRUE;