[Form] Close Form

[Form] Close Form

public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

[System.Runtime.InteropServices.DllImport("user32.dll")]
public static extern bool EndWindow(IntPtr hDlg, out IntPtr nResult);

//使用方式
 IntPtr dig = FindWindow(null, Form.name);

 if(dig != IntPtr.ZERO)
 {
     IntPtr resurt;
     EndWindow(dig, out result);
}