Share via


Working with WebBrowser Events (Windows Embedded CE 6.0)

1/6/2010

The WebBrowser control sends several different events to notify an application of user-generated activity. The events are implemented by using the DWebBrowserEvents2 interface. When the control is about to browse to a new location, it sends a DWebBrowserEvents2::BeforeNavigate2 event, specifying the URL or path of the new location and any other data that will be transmitted to the Internet server through the http transaction. The data can include the http header, http post data, and the URL of the referrer. The event also includes a cancel flag. After it has navigated to a new location, the WebBrowser control sends the DWebBrowserEvents2::NavigateComplete2 event. This event includes the same information as DWebBrowserEvents2::BeforeNavigate2, except that it does not include the cancel flag.

When the WebBrowser control is about to begin a download operation, it sends the DWebBrowserEvents2::DownloadBegin event. The control sends several DWebBrowserEvents2::ProgressChange events as the operation progresses. When the operation is complete it sends the DWebBrowserEvents2::DownloadComplete event. Applications typically use these three events to indicate the progress of the download operation, frequently by displaying a progress bar. An application would show the progress bar in response to DWebBrowserEvents2::DownloadBegin, update the progress bar in response to DWebBrowserEvents2::ProgressChange, and hide it in response to DWebBrowserEvents2::DownloadComplete.

When an application calls the IWebBrowser2::Navigate method with the Flags parameter set to navOpenInNewWindow, the WebBrowser control sends the DWebBrowserEvents2::NewWindow2 event before going to the new location. The event includes information about the new location and a flag that indicates whether the application or the control is to create the new window. Set this flag to TRUE if your application will create the window or to FALSE if the WebBrowser control should create it.

See Also

Other Resources

Internet Explorer Browser Control Host Application Development