(转) C# sendmessage向记事本发"F5",让记事本显示时间
原文:http://zhidao.baidu.com/question/62255753.html?fr=qrl&fr2=query
System.Diagnostics.Process p = new System.Diagnostics.Process();
string strPath = System.Environment.SystemDirectory + @""NotePad.exe";
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(strPath);
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized;
//startInfo.Arguments = "abc.txt";
p.StartInfo = startInfo;
p.Start();
p.WaitForInputIdle(1000);
if (p.Responding)
{
DateTime dt = DateTime.Now;
SendKeys.SendWait("{F5}");
}
else
{
p.Kill();
}
浙公网安备 33010602011771号