fixed: LibCecTray - keypress not sent when multiple instances of eshell.exe are runni...
authorLars Op den Kamp <lars@opdenkamp.eu>
Mon, 27 Oct 2014 21:10:53 +0000 (22:10 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Mon, 27 Oct 2014 21:11:16 +0000 (22:11 +0100)
thanks @pvanbaren

src/LibCecTray/controller/applications/ApplicationController.cs

index 3c7b83f1a0657054993c9862d6168e77c6987248..b4c6120e81959a85c116f87149d358395d48ff8f 100644 (file)
@@ -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