Fenster in Vordergrund
Anbei ein kleines Snippet um einen Prozess in den Vordergrund zu holen (wie z.B. EPLAN –> “W3u”).
using System.Runtime.InteropServices;
using System.Diagnostics;
private void SetProcessActive(string processName)
{
System.Diagnostics.Process[] p = System.Diagnostics.Process.GetProcessesByName(processName);
if (p.Length > 0)
{
SetForegroundWindow(p[0].MainWindowHandle);
}
}
// Fenster Vordergrund
[DllImport("user32.dll")]
public static extern bool SetForegroundWindow(IntPtr hWnd);