110,538
社区成员
发帖
与我相关
我的任务
分享
public const int WM_CLOSE = 0x10;
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SendMessageA")]
public static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
private void button1_Click(object sender, System.EventArgs e)
{
IntPtr hwnd_win;
hwnd_win = FindWindow(null, "要找的窗体名");
SendMessage(hwnd_win, WM_CLOSE, 0, 0);
}
public const int WM_CLOSE = 0x10;
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SendMessageA")]
public static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
private void button1_Click(object sender, System.EventArgs e)
{
IntPtr hwnd_win;
hwnd_win = FindWindow(null, "要找的窗体名");
SendMessage(hwnd_win, WM_CLOSE, 0, 0);
}