日期:2014-05-17 浏览次数:20820 次
private void button1_Click(object sender, EventArgs e) { IntPtr hwnd = FindWindow(textBox_classname.Text, null); //查找句柄 if (hwnd != IntPtr.Zero) { ShowWindow(hwnd, 9);//显示窗体 SetForegroundWindow(hwnd); //将程序设为当前活动窗口 SendKeys.Send("{F1}"); // System.Threading.Thread.Sleep(5000); // MessageBox.Show("1", "提示", MessageBoxButtons.OK); } else { MessageBox.Show("没有启动 [MX3]","提示",MessageBoxButtons.OK,MessageBoxIcon.Error); } }