Slowed app in C# form

91 Views Asked by At

I start app and set is as child in form app. But app is slow and when I open new tab when loading another page app falldown.

Process p = Process.Start("C:/Users/---/Desktop/Tor Browser/Browser/firefox.exe");
p.WaitForInputIdle();
System.Threading.Thread.Sleep(7000);
appWin = p.MainWindowHandle;
SetParent(appWin, this.Handle);

I use thread because I need to wait to connect browser and open it, than set it. Is there any option how to make it faster give to process more resources?

1

There are 1 best solutions below

1
On

Not sure what's the intention behind sleeping the UI thread by 7 seconds as can be seen in your code. You shouldn't do that and moreover, consider running that external exe in a separate thread than UI thread.

System.Threading.Thread.Sleep(7000);