The information in this article applies to:
SUMMARYThis article gives general information on how the default Web browser is registered, how to launch the default Web browser with ShellExecute, and details on how ShellExecute causes Internet Explorer to navigate to a URL. MORE INFORMATIONDetermining the Default Web BrowserBy default, Internet Explorer checks to see if it is the default browser each time it starts. If Internet Document (HTML) files are associated with a different browser when Internet Explorer starts, Internet Explorer recognizes that it is not the default browser and prompts you to make it the default browser.When you select Make this the default browser in Internet Explorer and later versions of Netscape, the browser registers itself into all of the following keys to make it the "default" browser (Even though more entries are being written).
Launching the Default Web Browser from Your ApplicationThe easiest way to launch the default Web browser from your application is to simply call the ShellExecute API and pass it a URL. If the default Web browser is currently running, ShellExecute will tell the running instance to navigate to your URL. If it is not running, ShellExecute will start the application and navigate to your URL.If you are developing your application in Visual C++, the following code demonstrates how to call ShellExecute in your application:
If you are using Visual Basic, you will need to insert the ShellExecute declaration in your project. This declaration can be found in the Win32api.txt that is located in a sub-folder of your Microsoft Visual Studio installation (C:\Program Files\Microsoft Visual Studio\Common\Tools\WinApi for a default Visual Studio 6.0 installation). Or you could copy it from API Text Viewer tool that comes with Visual Studio 6.0.
To do this in Visual Basic, follow these steps:
How ShellExecute WorksThe following is provided for informational purposes only. It is intended to provide general insight so that you might better understand how your application is interacting with the operating system. However, it is not intended that you base your designs on assumptions drawn from this information. Please be aware that this functionality may change in future versions of Microsoft products. How ShellExecute Interprets the URL PassedShellExecute parses the string passed to it to extract either a protocol specifier or a file extension, which it then uses to determine what application to launch by looking in the registry. If you pass "http://www.microsoft.com" to ShellExecute, the "http://" sub-string is recognized as a protocol, which causes it to look at "HKCR\http\shell\open" for information on how to execute. If you pass "myfile.htm" to ShellExecute, the ".htm" sub-string is recognized as a file extension causing it to look at "HKCR\.htm," which leads to "HKCR\htmlfile\shell\open."Generally, it's best to fully specify your URL in the string passed to ShellExecute, as in "http://www.microsoft.com" rather than "www.microsoft.com." That way ShellExecute knows exactly which protocol you want. However, some obvious patterns like "www.*" and and "ftp.*" are detected and mapped to the http protocol and the ftp protocol, respectively, by default. How ShellExecute Determines Whether It Should Launch a New InstanceWhen ShellExecute is looking through the registry, it is ultimately looking for the "shell\open" subkey. If the "shell\open\ddeexec" key is defined, then a DDE message with the specified application "IExplore" and topic "WWW_OpenURL" is broadcast to all top-level windows on the desktop. The first application to respond to this message is the application that will navigate to the requested URL. If no applications respond to this DDE message, then ShellExecute uses the information contained in the "shell\open\command" subkey to launch the application. It then re-broadcasts the DDE message to navigate to the requested URL.REFERENCESFor more information, please see the following articles in the Microsoft Knowledge Base: Q164539 Determining Which Version of Internet Explorer You Are Using Additional query words:
Keywords : kbIE300 kbIE301 kbIE401 kbWebBrowser kbWinOS95 kbWinOS98 kbGrpInet |
Last Reviewed: May 25, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |