Posted by a small bot, which follows the links. Added the ability to collapse to tray, so as not to interfere. So, when the application is in the tray and makes a click, the focus is removed from other windows, it causes discomfort. I sit, for example, in the browser, I type something, and then bang - the focus is removed from the browser and you need to click again on the text field. If you simply minimize the application, then this does not happen. Is there a way to get rid of it?

A click is done as follows: element.InvokeMember("Click");

  • Take a look here . - Alexander Petrov
  • @AlexanderPetrov, Thank you, this method works. For each click made Enabled = false; and at the DocumentCompleted event, back to Enabled = true; . - AntiFreez
  • @AlexanderPetrov: Then it makes sense to write an answer? - VladD

1 answer 1

WebBrowser can really steal the focus when the URL is loaded.

To prevent this, reloading should set the Enabled property of the parent browser control to false; . And after its completion, in the DocumentCompleted event, set back to true .