using System.Diagnostics;
using System.Runtime.InteropServices;
[DllImport("User32.dll")]
private static extern Int32 SetForegroundWindow(nint hWnd);
void YourMethod()
{
Process p = ... // However you create your process
SetForegroundWindow(p.MainWindowHandle); // Set this process's main window as the foreground window
}
1条答案
按热度按时间js81xvg61#
使用PInvoke调用本机函数以设置前台窗口: