C # WebBrowser not throwing DocumentCompleted event

I have a program that uses the C # WebBrowser control and it needs to determine which page is loaded in order to determine what to do next. The program works great on most office staff computers, but it doesn’t work on some.

I decided that the problem is that the event documentCompleteddoes not fire on those computers on which it does not work.

This program uses threads to process data, and the call is webbrowser.navigatemade through the delegate. But I also changed the code so as not to use delegates for the navigation action without changing the result.

I also created a separate program that has only the base WebBrowserand debug textfield, and when using this << → << → .

NOTE. Computers on which it does not start are older PCs with single-core / stream processors.

I have no ideas on this, any help would be appreciated.

+3
source share
7 answers

As explained by CodeBlock, this seems to be related to the installation status Microsoft.mshtml.dll

We have clients where Microsoft.mshtml.dllnot in the GAC (and not on the computer), and then the component WebBrowsernever fires any event.

Reflector WebBrowser, DocumentComplete WebBrowserEvent, DWebBrowserEvents2.

ComImport of {34A715A0-6587-11D0-924A-0020AFC7AC4D}, , , Microsoft.mshtml.dll.

, Interop Assemblies Office 2003, DLL Program Files GAC.

. .NET Framework 1.1 , DLL.

2: 2007 , , DLL.

+6

@Pavel L:

, - mshtml.dll, .NET framework . mshtml.dll " " Microsoft.mshtml "".

: D

+4

WebBrowser using(), DocumentCompleted. - WebBrowser , ?

+3

, , Application.DoEvents(). , WebBrowser , .

+2

, , .

, DocumentComplete - Microsoft.mshtml.dll. Visual Studio. . :

  • Microsoft.mshtml.dll "% ProgramFiles%\Microsoft.NET\Primary Interop Assemblies".
  • "% SystemRoot%\Assembly".
  • RegAsm.exe( "% windir%\Microsoft.NET\Framework" ).

P.S. , , , , .

+1

To trigger documentCompleted-Event, the
visible property of the web browser must be set to true.

It may also be visible if you have multiple screens.
If you have a screen> 1, turn off everything except the main screen, this should fix the problem.
Also, move the window to the second screen.

+1
source

Make sure webbrowser.Visible=true;this works for me, I had similar problems before.

0
source

Source: https://habr.com/ru/post/1705810/


All Articles