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
Read More:
- To solve the problem of C # calling excel interface error, prompt: the COM object of Microsoft. Office. Interop. Excel. Applicationclass is forcibly converted to the interface type “Microsoft. Offi”
- After JQ gets the tag element itself, it gets its own HTML text format (find only finds one level of child elements)
- error: non-const lvalue reference to type cannot bind to a value of unrelated type
- Solution to the error “tcnative-1.dll: can’t load amd 64 bit. DLL on IA 32 bit platform”
- 2017 vs can’t reference problem solution
- Refused to apply style from <URL> because its MIME type (‘text/html‘) is not a supported stylesheet
- The solution of undefined reference to error
- Es error mapper of different type, current_ Type “text” solution
- Error: Microsoft Visual C + + 14.0 is required to get it with Microsoft V + + comp
- Failed to add the foreign key constraint. Missing index for constraint ‘stu_ibfk_1’ in the reference
- PIP installation error: Microsoft Visual C + + 14.0 is required perfect solution
- “Error! Reference source not found.” “error! Reference source not found solution to problem for
- PIP installation error: error: Microsoft Visual c++ 14.0 is required perfect solution
- Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build Tools“
- Vscode HTML file auto supplement HTML skeleton failure
- Game development unity xlua framework knowledge series: this type must add to csharpcalllua error reporting solutions
- Error: Microsoft Visual C + + 14.0 is required. Get it with “Microsoft Visual C + + build tools” problem
- Solution to msxml3.dll error ‘800c0008’ the system cannot locate the resource specified
- Error: Microsoft Visual C + + 14.0 is required. Get it with “Microsoft Visual C”++
- Microsoft SQL server, additional database error: error 916 solution