I see an example from the website
http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser%28v=VS.90%29.aspx
Here they are using a statement like:
SHDocVw.DWebBrowserEvents_Event wbEvents = (SHDocVw.DWebBrowserEvents_Event)myWebBrowser2;
SHDocVw.DWebBrowserEvents2_Event wbEvents2 = (SHDocVw.DWebBrowserEvents2_Event)myWebBrowser2;
When i compile the program i am getting the following error. Am i missing anything?
Cannot convert type ‘System.Windows.Controls.WebBrowser’ to ‘SHDocVw.DWebBrowserEvents’
The exception tells you that your myWebBrowser2 is of type ‘System.Windows.Controls.WebBrowser’. However in the example it is of type ‘SHDocVw.IWebBrowser2’. It seems you have skipped the part where they extract the IWebBrowser2 from the WPF WebBrowser control (in this example ‘myWebBrowser’ is your WebBrowser control):
And then myWebBrowser2 is ready for interaction.