based on this control: http://www.codeproject.com/KB/cpp/ExtendedWebBrowser.aspx
There is a function NavigateError, it is triggered when an error occurs during navigation. here is my modified code:
first enter the argument argument class:
public class NavigateErrorArgs : EventArgs { public object StatusCode { get; set; } public NavigateErrorArgs() : base() { } public NavigateErrorArgs(object statusCode) : base() { this.StatusCode = statusCode; } }
then add the delegate and event to the ExtendedWebBrowser class:
public delegate void NavigateErrorHandler(object sender, NavigateErrorArgs e); public event NavigateErrorHandler NavigateError; protected void OnNavigateError(NavigateErrorArgs e) { if (NavigateError != null) NavigateError(this, e); }
public delegate void NavigateErrorHandler(object sender, NavigateErrorArgs e); public event NavigateErrorHandler NavigateError; protected void OnNavigateError(NavigateErrorArgs e) { if (NavigateError != null) NavigateError(this, e); }
and modify the method in the WebBrowserExtendedEvents class:
public void NavigateError(object pDisp, ref object URL, ref object frame, ref object statusCode, ref bool cancel) { _Browser.OnNavigateError(new NavigateErrorArgs(statusCode)); }
source share