public static extern IntPtr GetForegroundWindow(); // For Windows Mobile, replace user32.dll with coredll.dll