안녕 모두,
JMP 프로세스가 백그라운드 프로세스로 실행 중일 때 JMP 창을 여는 데 문제가 있습니다.
이 프로세스가 종료되면 모든 것이 정상적으로 작동합니다.
이 프로세스를 수동으로 종료하지 않고 자동화 작업을 수행 할 수 있습니까?
감사,
그렉
고맙습니다 @성유 !
그것은 내가 필요한 것에 매우 가깝습니다.
사용자는 전경에서 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);그것은 매력처럼 작동합니다.
