代码:
if(this.IsHandleCreated)
{
this.BeginInvoke(new EventHandler(delegate{
// 代码
ListView2.Items.Clear();
}))
}
雄关漫道真如铁 而今迈步从头越
代码:
if(this.IsHandleCreated)
{
this.BeginInvoke(new EventHandler(delegate{
// 代码
ListView2.Items.Clear();
}))
}
以下是代码:
Process process = new Process();
string exePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "a.exe");
string s = "";
foreach (var tmpArg in args)
{
s += tmpArg.ToString() + " ";
}
s = s.Trim();
if (string.IsNullOrWhiteSpace(s))
{
throw new Exception("缺少参数");
}
ProcessStartInfo psi = new ProcessStartInfo(exePath , s)
{
CreateNoWindow = true,
UseShellExecute = false,
};
process.StartInfo = psi;
process.Start();
process.WaitForExit();