资 源 简 介
C# 启动外部计算器计算数据,private void button1_Click(object sender, EventArgs e)
{//启动计算器计算数据(从当前程序向其他程序发送键击数据)
ProcessStartInfo MyStartInfo = new ProcessStartInfo();
MyStartInfo.FileName = "Calc.exe";
Process MyProcess = new Process();
MyProcess.StartInfo = MyStartInfo;
MyProcess.Start();
System.Threading.Thread.Sleep(100);
IntPtr MyHandle = FindWindow("SciCalc", "计算器");
if (MyHandle == IntPtr.Zero)
{
MessageBox.Show("计算器程序没有运行","信息提示",MessageBoxButtons.OK);
return;
}
SetForegroundWindow(MyHandle);
SendKeys.SendWait("88");
SendKeys.SendWait("*");
SendKeys.SendWait("8");
SendKeys.SendWait("=");
}