Tag Archives: Error in introducing HTML into ima tag

Ima tag error HTML, microsoft.mshtml.dll add reference and type selection error solution

In earlier articles, we mentioned the use of   Microsoft.mshtml.dll to simulate the example of browser click.

1. The problem of adding references

In general, microsoft.mshtml.dll will be stored in three places in the development environment. So when you add a reference, three seemingly identical items appear. For developers, any one of them will not affect the normal development. But the problem will be after the software release! When running on the client’s machine, it usually prompts that the signature of the file is incorrect and cannot be loaded.

The solution is to delete the current reference to mshtml. Reselect the correct reference. It’s the bottom one. The path is: X: program files, microsoft.net, primary interop assemblies, microsoft.mshtml.dll. Expand the reference dialog box to see the path of the file.

2. Wrong type selection

If the problem is solved, or you choose right from the beginning. Maybe the client is running and reporting system_ Comobject cannot be cast to htmlwindow2class, htmldocumentclass, or other similar errors. It runs on the developer’s machine, but it’s completely normal. At this time, usually we will grab, completely do not know why! In the development environment, using obj. Tostring() to show that htmlxxxxclass gets the result of system_ ComObject.

The solution is very simple. Replace htmlxxxxclass with htmlxxxxx. You can find and replace all the classes following htmlwindow2class, htmldocumentclass, etc. But don’t make your public class XXX public XXX

The above methods are summarized from the actual project development of Visual Studio 2008/2010.

Original text: https://www.cnblogs.com/soundcode/p/9770410.html