你能在最顶层的窗口上启动一个进程吗? (csharp wpf)

你能在最顶层的窗口上启动一个进程吗? (csharp wpf)我有以下内容,但是这个窗口之前的当前窗口(使用具有topmost = true的窗口类的wpf窗口)在启动进程时仍然在进程的顶部。

if (System.IO.File.Exists(MY_CALC_PATH)) { System.Diagnostics.Process helpProcess = new System.Diagnostics.Process(); helpProcess.StartInfo.FileName = "calc.exe"; helpProcess.Start(); helpProcess.WaitForInputIdle(); BringWindowToTop(helpProcess.MainWindowHandle); SetWindowPos(helpProcess.MainWindowHandle, myCurrentTopmostWinHnd, 0, 0, 0, 0, SWP_NOSIZE_); } 

您需要通过调用SetParent将Calculator窗口设置为TopMost窗口的子窗口。

然而,这种方法有缺点 。