getwindow example c# Example: c# getforegroundwindow [DllImport("user32.dll")] private static extern IntPtr GetForegroundWindow();