2

你能在最上面的窗口上启动一个进程吗?(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_);
}
4

1 回答 1

3

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

但是,这种方法也有缺点

于 2011-11-29T14:47:57.310 回答