Adding Internet Browsing Functionality to Your Application (Windows Embedded CE 6.0)


One of the most common uses for the WebBrowser control is to add Internet browsing functionality to your application. When the IWebBrowser2 interface is implemented, users can browse to any location in the local file system, on the network, or on the World Wide Web. The IWebBrowser2::Navigate method specifies the target location to the control. The first parameter is a string that specifies the name of the location. To browse to a location in the local file system or on the network, this string would be the full path to the file system location or the Universal Naming Convention (UNC) name of the location on the network. To browse to a site on the World Wide Web, this string would contain the Uniform Resource Locator (URL) of the site. By including a text box in your application, you can let the user specify the location to browse to and then pass the location to the IWebBrowser2::Navigate method.

In addition, the IWebBrowser2::Navigate method makes it possible to target a specific frame on the current HTML page, displaying the new Web site or file system location within that frame. To do this, first call the IWebBrowser2::Navigate method and specify the URL of an HTML page that contains a frame. Then, by specifying the name of the frame in subsequent calls to IWebBrowser2::Navigate, you can direct the control to display subsequent locations within that frame.

You can also use the IWebBrowser2::get_LocationName and IWebBrowser2:: get_LocationURL methods to retrieve information about the location of the current page being displayed. If the location is an HTML page on the World Wide Web, a call to get_LocationName retrieves the title of that page and a call to get_LocationURL retrieves the URL of that page. If the location is a folder or file on the network or local computer, these methods retrieve the UNC or full path of the folder or file.

Community Additions