Questions tagged [mshtml]

MSHTML was introduced in Microsoft Internet Explorer 4.0. It is the main HTML component of the Internet Explorer browser and can be used in other applications. It hosts Microsoft ActiveX Controls and supports the OLE Control '96 (OC96) specification for windowless controls.

MSHTML frequently comes into play when a WPF or WinForms application hosts a web browser control. To access MSHTML, the 'Add Reference' dialog is used as shown in the figure below...

Locating the MSHTML assembly

Reference articles for MSHTML can be found here

444 questions
34
votes
8 answers

MSHTML DLL on Windows 10

I have a C# solution that makes use of Smith Html Editor (I'm developing on the main project which uses this, so I don't know much about this library), which makes a reference to MSHTML. This worked fine until my upgrade to Windows 10 and it can't…
Tyress
  • 3,573
  • 2
  • 22
  • 45
33
votes
2 answers

Can't set IHTMLEventObj2::fromElement

I'm trying to generate synthetic Javascript events in an Internet Explorer extension, and I'm having trouble getting the fromElement property to stick. Here's an excerpt of my code: MsHtml.IHTMLDocument4 doc4 = ... // the document object Object o =…
Greg
  • 10,360
  • 6
  • 44
  • 67
21
votes
5 answers

Could not load file or assembly 'Microsoft.mshtml ... Strong name validation failed

I made a WPF/C# program and I am using the internet control for WYSIWYG HTML editing. it is a regular Executable program. it works on most computers however some computers are giving me the following error. Could not load file or assembly …
Rabbi
  • 4,622
  • 9
  • 35
  • 45
20
votes
4 answers

Using mshtml doesn't work

I have a c# app and i have tried using some mshtml elements. But i have a problem. The using mshtml; namespace gives me a error is Visual Studio 2012. Here is my source code, namespace Tagger { using mshtml; using System; using…
kks21199
  • 1,116
  • 2
  • 10
  • 29
19
votes
12 answers

Blocking dialogs in .NET WebBrowser control

I have a .NET 2.0 WebBrowser control used to navigate some pages with no user interaction (don't ask...long story). Because of the user-less nature of this application, I have set the WebBrowser control's ScriptErrorsSuppressed property to true,…
Adam Neal
  • 2,147
  • 7
  • 24
  • 39
15
votes
3 answers

How to render HTML element without using web browser?

Is there a way how to draw specific HTML element content on a canvas without using any web browser control ? With this code I'm rendering the element to the form's canvas (just as an example). It works though, but this code is not a good practice -…
TLama
  • 75,147
  • 17
  • 214
  • 392
12
votes
12 answers

HTML - How do I know when all frames are loaded?

I'm using .NET WebBrowser control. How do I know when a web page is fully loaded? I want to know when the browser is not fetching any more data. (The moment when IE writes 'Done' in its status bar...). Notes: The DocumentComplete/NavigateComplete…
Yuval Peled
  • 4,988
  • 8
  • 30
  • 36
11
votes
2 answers

Why doesn't IWebBrowser2 refresh after a DOM change?

A have a web browser embedded in a dialog of my Win32 C++ application (no MFC, ATL, etc.) and I initially set the document's content from a string containing some HTML code. This HTML is rendered correctly. When the "document complete" event occurs,…
Dabbler
  • 9,733
  • 5
  • 41
  • 64
10
votes
2 answers

Using querySelectorAll on an mshtml.HTMLDocumentClass object in PowerShell causes a crash

I'm trying to do some web-scraping via PowerShell, as I've recently discovered it is possible to do so without too much trouble. A good starting point is to just fetch the HTML, use Get-Member, and see what I can do from there, like so: $html =…
9
votes
1 answer

Rundll32.exe javascript

I've just (August 2014) seen a report of a program that uses the command line rundll32.exe javascript:"\..\mshtml,RunHTMLApplication" How does that work? I thought the first parameter was supposed to be the name of a DLL (mshtml), but how does…
david
  • 2,435
  • 1
  • 21
  • 33
7
votes
1 answer

How to add a reference to mshtml version 9 in .NET

I want to use some of the new features of mshtml.dll version 9.0 such as IHTMLCSSRule. The interop version in the following folder is version 7.0.3300.1: C:\Program Files\Microsoft.NET\Primary Interop Assemblies\Microsoft.mshtml.dll The COM…
Jules
  • 4,319
  • 3
  • 44
  • 72
7
votes
1 answer

How can we use MSHTML with VBA?

I saw a lot of examples in MSDN on how to use MSHTML in VS. Have anyone known if and how we can use MSHTML and VBA to open web pages?
Martin08
  • 20,990
  • 22
  • 84
  • 93
7
votes
2 answers

Do I absolutely need to call ReleaseComObject on every MSHTML object?

I'm using MSHTML with a WebBrowser control because it gives me access to things the WebBrowser doesn't such as text nodes. I've seen several posts here and on the web where people say you must call ReleaseComObject for every COM object you…
Juan
  • 15,274
  • 23
  • 105
  • 187
7
votes
4 answers

Why does Microsoft have IHTMLDocument, IHTMLDocument2, ... , IHTMLDocument8?

What is the meaning of the number in the end of the interface name? I see that IHTMLDocument3-7 have no members (see example for #5), and 8 has gesture related members. Is the number derived from Windows version?
zenpoy
  • 19,490
  • 9
  • 60
  • 87
7
votes
4 answers

How to disable Javascript in mshtml.HTMLDocument (.NET)

I've got a code like this : Dim Document As New mshtml.HTMLDocument Dim iDoc As mshtml.IHTMLDocument2 = CType(Document, mshtml.IHTMLDocument2) iDoc.write(html) iDoc.close() However when I load an HTML like this it executes all Javascripts in it as…
Dev Dona
1
2 3
29 30