From: Lars Op den Kamp Date: Mon, 27 Oct 2014 21:10:53 +0000 (+0100) Subject: fixed: LibCecTray - keypress not sent when multiple instances of eshell.exe are runni... X-Git-Tag: upstream/2.2.0~1^2~1^2~3^2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=62f95dbc26cbc48254ed9353a66a24d053f9bf2e;p=deb_libcec.git fixed: LibCecTray - keypress not sent when multiple instances of eshell.exe are running. closes #10 thanks @pvanbaren --- diff --git a/src/LibCecTray/controller/applications/ApplicationController.cs b/src/LibCecTray/controller/applications/ApplicationController.cs index 3c7b83f..b4c6120 100644 --- a/src/LibCecTray/controller/applications/ApplicationController.cs +++ b/src/LibCecTray/controller/applications/ApplicationController.cs @@ -273,7 +273,12 @@ namespace LibCECTray.controller.applications protected virtual IntPtr FindInstance() { var processes = Process.GetProcessesByName(ProcessName); - return processes.Length > 0 ? processes[0].MainWindowHandle : IntPtr.Zero; + foreach (var process in processes) + { + if (process.MainWindowHandle != IntPtr.Zero) + return process.MainWindowHandle; + } + return IntPtr.Zero; } #endregion