I tried to run it without a container form, but the DocumentCompleted event doesn’t fire.
I tried to run it in a Form with opacity set to 0% but the process isn’t completely hidden, since it appears to the user when he uses Alt+Tab
I don’t mind if the proccess appears on the Task Manager though.
To prevent the window from being shown, paste this code into your form:
Beware that the Load event won’t run until you explicitly make your form visible so move any code you’ve got there inside the if statement.
Not getting the DocumentCompleted event to run is usually caused by not running a message loop (Application.Run). WebBrowser requires one, and a thread that’s marked with [STAThread], in order to fire its events. The message loop is very important for COM components.
Is it also important to prevent the invisible form from stealing focus, with the code below:
and