using System.Runtime.InteropServices; using System.Text; namespace WindowWatcher; internal static partial class NativeMethods { [LibraryImport("user32.dll")] internal static partial IntPtr GetForegroundWindow(); [DllImport("user32.dll", CharSet = CharSet.Unicode)] internal static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int count); [LibraryImport("user32.dll", SetLastError = true)] internal static partial uint GetWindowThreadProcessId(IntPtr hWnd, out uint processId); }