大家好,
当JMP进程作为后台进程运行时,我遇到了打开JMP窗口的问题。
一旦这个过程被杀死,一切正常。
有没有办法使自动化工作而不手动杀死这个过程?
谢谢,
格雷格
谢谢 @ChrisM !
它非常接近我所需要的。
我们的用户可能希望将JMP保持在前台打开状态。所以我只需要找到后台进程。
替换foreach循环:
//if having trouble attaching to JMP, then start fresh, kill all JMP processes and try again!
foreach (var process in Process.GetProcessesByName("jmp"))
{
DialogResult d = MessageBox.Show("All JMP windows will be closed, please save files prior to clicking YES!!! Click NO, to disable JMP functionality, and leave JMP open", "JMP Warning", MessageBoxButtons.YesNo);
if (d != DialogResult.Yes)
{
//this.Shown += new EventHandler(MyForm_CloseOnStart);
return false;
}至:
//Kill all the JMP processes in background
foreach (var process in Process.GetProcessesByName("jmp"))
{
if (process .MainWindowHandle == IntPtr.Zero)
{
process .Kill();
}
}
System.Threading.Thread.Sleep(200);它就像魅力一样。:)