public static IntPtr StartProgram(string workingDirectory, DemoAppLauncherSelection app, BrokerAppType subApp, WindowLayout wp) { var startInfo = new ProcessStartInfo("dotnet"); startInfo.Arguments = $"run --no-build {app.ToString()} {subApp.ToString()}"; startInfo.UseShellExecute = true; startInfo.WorkingDirectory = workingDirectory; var process = new Process(); process.StartInfo = startInfo; process.Start(); Thread.Sleep(500); var handle = process.MainWindowHandle; if (!MoveWindow((IntPtr)handle, wp.StartX, wp.StartY, wp.Width, wp.Height, true)) { throw new Win32Exception(); } return((IntPtr)handle); }