1,首先引入命名空间
using System.Runtime.InteropServices;
2,写入要调用的API的名字
//调用API
[DllImport("user32.dll", EntryPoint = "ShowWindow")]
public static extern int ShowWindow(int hwnd, int nCmdShow);
public const int SW_SHOW = 5; public const int SW_HIDE = 0;
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
private static extern int SystemParametersInfo(int uAction, int uParam, ref Rectangle