I am trying to use MSHTML in a Silverlight application. I created a Silverlight application and added a WebBrowser control to the MainPage.xaml. In the designer the WebBrowser control says that HTML is enabled only in OOB mode so I enabled OOB mode.
When I try to add a reference to mshtml.tlb I get the error message "An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)". I am able to add a reference to mshtml.tlb for other applications. When I research that error, it seems there is an inconsistency between 32-bit and 64-bit.
It is confusing. If someone knows what I am doing wrong then that could save me tme. Otherwise I will continue to attempt to figure it out.
Loading

Sam HobbsPosted Apr 29, 2012, 5:12 PM
That article has a lot in it but essentially nothing about mshtml. The reason I was trying to use mshtml is that the WebBrowser control does not expose everything; the HTML DOM has much more. I have given up trying to use the Silverlight WebBrowser control. I am now using the HTML that is in the page that contains the Silverlight control. I might be able to use the Silverlight WebBrowser control but it only works OOB and I am trying to stay in the box.
I have learned a lot. I have learned about the Silverlight HTML Bridge. It does (seems to do) even less than what the WebBrowser control does except I am learning it can be used to do all or nearly all that I would use mshtml to do; it is a matter of learning how to use it. Just minutes before receiving notification of your reply, I was successful at using Silverlight to create an iframe in the page that the Silverlight control (application) is in and then set some HTML in the iframe. That is not as simple to do for an iframe as it is for most other HTML elements. There is much, much more to learn but I feel good about accomplishing as much as I have.
The thing that I am still not sure of is if it is possible to use COM objects such as mshtml in Silverlight. I think I get the same error message if I try to add a reference for any COM library to a Silverlight application.
Suthish NairPosted Apr 29, 2012, 3:12 PM
try this link