public static int BM_CLICK = 0xf5;
//关闭winform 弹窗的方法
private void button3_Click(object sender, EventArgs e)
{
Thread thread = new Thread(fff);
thread.Start();
Thread.Sleep(2000);
int hwnd = FindWindow(null, "this");
hwnd = FindWindowEx(hwnd, 0, "Button", "确定");
IntPtr intPtr1 = SendMessage(hwnd, BM_CLICK, 0, 0);
}