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);
}
本文介绍了一种使用C#在WinForm应用中自动关闭弹窗的方法。通过创建线程调用特定API,实现对确定按钮的模拟点击,从而达到自动关闭对话框的目的。
820

被折叠的 条评论
为什么被折叠?



