I'm not the greatest with COM objects but, I have a need to extend the WebBrowser control to support flags in the navigate method (Specifically to prevent reading/writing from cache).
From what I gather I'll need to implement IWebBrowser2 to some extent. Can I just implement the Navigate method or do I need to define all methods in the interface?
I've found some examples for attaching/detaching an event sink to extend the events of the web browser but very little around the actual Methods.
Can I use the underling ActiveXInstance of the WebBrowser control? If I create a class that implements IWebBrowser2::Navigate, and cast a variable to it that class, assigning the WebBrowser control ActiveXInstance then attempt to Navigate I get a COM exception HRESULT E_FAIL
I found this but not sure if the underlying control is still ShDocVw as I didn't see it in my COM objects (Target FW .Net 3.5): Web Browser to handle pop ups within the application
internal ShDocVw.WebBrowser ActiveXWebBrowser { get; private set; }`
new public void Navigate(string url)
{
this.Navigate(url, axNativeMethods.WebBrowserNavigateFlags.NoReadFromCache | axNativeMethods.WebBrowserNavigateFlags.NoWriteToCache, string.Empty, new byte[] { }, string.Empty);
}
public void Navigate(string url, axNativeMethods.WebBrowserNavigateFlags flags, string targetFrameName, byte[] postData, string headers)
{
this.ActiveXWebBrowser = (ShDocVw.WebBrowser)this.ActiveXInstance;`
object flagsObj = (flags == axNativeMethods.WebBrowserNavigateFlags.None) ? null : (object)flags;
object targetFrameNameObj = targetFrameName;
object headersObj = headers;
object postDataObj = postData;
ActiveXWebBrowser.Navigate(url, ref flagsObj, ref targetFrameNameObj, ref postDataObj, ref headersObj);
}