| 452 if (GetLastError() == ERROR_ALREADY_EXISTS) { |
452 if (GetLastError() == ERROR_ALREADY_EXISTS) { |
| 453 HWND msg_win; |
453 HWND msg_win; |
| 454 |
454 |
| 455 printf("An instance of Pidgin is already running.\n"); |
455 printf("An instance of Pidgin is already running.\n"); |
| 456 |
456 |
| 457 if((msg_win = FindWindow(TEXT("WinpidginMsgWinCls"), NULL))) |
457 if((msg_win = FindWindowEx(HWND_MESSAGE, NULL, TEXT("WinpidginMsgWinCls"), NULL))) |
| 458 if(SendMessage(msg_win, PIDGIN_WM_FOCUS_REQUEST, (WPARAM) NULL, (LPARAM) NULL)) |
458 if(SendMessage(msg_win, PIDGIN_WM_FOCUS_REQUEST, (WPARAM) NULL, (LPARAM) NULL)) |
| 459 return FALSE; |
459 return FALSE; |
| 460 |
460 |
| 461 /* If we get here, the focus request wasn't successful */ |
461 /* If we get here, the focus request wasn't successful */ |
| 462 |
462 |
| 492 if (len == 0) { |
492 if (len == 0) { |
| 493 printf("No protocol message specified.\n"); |
493 printf("No protocol message specified.\n"); |
| 494 return; |
494 return; |
| 495 } |
495 } |
| 496 |
496 |
| 497 if (!(msg_win = FindWindow(TEXT("WinpidginMsgWinCls"), NULL))) { |
497 if (!(msg_win = FindWindowEx(HWND_MESSAGE, NULL, TEXT("WinpidginMsgWinCls"), NULL))) { |
| 498 printf("Unable to find an instance of Pidgin to handle protocol message.\n"); |
498 printf("Unable to find an instance of Pidgin to handle protocol message.\n"); |
| 499 return; |
499 return; |
| 500 } |
500 } |
| 501 |
501 |
| 502 GetWindowThreadProcessId(msg_win, &pid); |
502 GetWindowThreadProcessId(msg_win, &pid); |