public async void StartProcess(string procName) { try { await(App.Current as App).WindowContainSemaphore.WaitAsync(); var cmd = new ProcessStartInfo(procName) { WindowStyle = ProcessWindowStyle.Minimized, CreateNoWindow = true, }; var process = Process.Start(cmd); while (process.MainWindowHandle == IntPtr.Zero) { await Task.Delay(10); } await CreateTabForWindow(process.MainWindowHandle, DefaultWindowNames.GetName(procName)); } finally { (App.Current as App).WindowContainSemaphore.Release(); } }
private void WindowTitleCheckTimer_Tick(object sender, EventArgs e) { foreach (var window in MainWindows) { foreach (var tab in window.TabsContainer.Tabs) { try { tab.Title = DefaultWindowNames.NormalizeTitle(Win32Functions.GetWindowText(tab.HostedWindowItem.WindowHandle)); } catch { } } } }