添加以下两个类
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace FileX
{
internal static class NativeMethods
{
/// <summary>
/// Gets the handle of the window that currently has focus.
/// </summary>
/// <returns>
/// The handle of the window that currently has focus.
/// </returns>
[DllImport("user32")]
internal static extern IntPtr GetForegroundWindow();
/// <summary>
/// Activates the specified window.
/// </summary>
/// <param name="hWnd">
/// The handle of the window to be focused.
/// </param>
/// <returns>
/// True if the window was focused; False otherwise.
/// </returns>
[DllImport("user32")]